Convert the while statement into a for statement? : While loop « Statement « PHP






Convert the while statement into a for statement?

 
<? 
$num = 1;
while ( $num <= 49 ) {
  print "$num<br />";
  $num += 2;
}

for ( $num = 1; $num <= 49; $num += 2 ) {
  print "$num<br />\n";
}
?>
  
  








Related examples in the same category

1.A sample while loop that counts to 10
2.A while Statement
3.Approximating a square root
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