A sample while loop that counts to 10 : While loop « Statement « PHP






A sample while loop that counts to 10

 
<?php
$num = 1;

while ($num <= 10){
    print "Number is $num<br />";
    $num++;
}

print 'Done.';
?>
  
  








Related examples in the same category

1.A while Statement
2.Approximating a square root
3.Convert the while statement into a for statement?
4.Create a while statement that prints every odd number between 1 and 49
5.while and loop counter
6.Infinite Loops
7.Fahrenheit and Celsius table by while loop
8.The do...while Statement
9.Printing a
10.A while Statement