Web EndMemo

PHP While Loop


while(expr) {...} iterate through a loop:
<?PHP
$ii=1;
$sum=0;
while($ii<100)
{
   $sum += $ii++;
}
?>


If there is only one statement inside, the curly braces can be removed. However, if there is more than one statement, keyword endwhile can be used to end the loop, if you do not want to use curly braces.
<?PHP
$ii=1;
$sum=0;
while($ii<100)
   $sum += $ii;
   $ii++;
   echo "$ii\n";
endwhile
?>