08-loops/index.php

Go to the documentation of this file.
00001 <?php
00010 define('TIMES', 10);
00011 
00012 
00014 define('STOP_AT',3);
00015 
00020 function main()
00021 {
00022     //Demonstrating use of for loop
00023     for($counter1=0; $counter1<TIMES; $counter1++)
00024         echo "A. Hello world <br/>\n";
00025 
00026     echo "<br/>\n<br/>\n";
00027 
00028 
00029     //Demonstrating use of while loop
00030     $counter2=0;
00031     while($counter2<TIMES)
00032     {
00033         echo "B. Hello world <br/>\n";
00034         $counter2++;
00035     }
00036 
00037     echo "<br/>\n<br/>\n";
00038 
00039     //Demonstrating use of break
00040     for($counter1=0; $counter1<TIMES; $counter1++)
00041     {
00042         if($counter1==STOP_AT)
00043             break;
00044         echo "C. Hello world <br/>\n";
00045     }
00046     
00047 
00048 }
00049 
00050 main();
00051 ?>

Generated on Fri Nov 4 14:16:54 2011 for PHP example documentation by  doxygen 1.4.7