[ create a new paste ] login | about

Link: http://codepad.org/B8DfYjDh    [ raw code | output | fork ]

php.programmer - PHP, pasted on Apr 20:
<?php
// easy and fast multiply integers by power of 2
$x = 4;
echo $x >> 1;
echo "\n";
$x = 8;
echo $x >> 1;
echo "\n";
$x = 200;
echo $x >> 1;
echo "\nmagic of break statement\n";
for ($i = 4; $i > 0; $i--) 
{
 for ($j = 1; $j < 4; $j++) 
   {
      if ($j%$i==0) 
      {
       break 2; // Exit from this loop and the next one also.
      }
      else
       {
           echo $j."\t";
       }
   }
  echo "\n";
}
?>


Output:
1
2
3
4
5
6
2
4
100
magic of break statement
1	2	3	
1	2	


Create a new paste based on this one


Comments: