for ( start; conditional; increment) { code to execute; }
Let's go back to our first example using the WHILE loop, where we printed out the numbers 1 through 10 and do the same thing using a FOR loop.
<?php
for ($num=1; $num <= 10; $num++ )
{
print $num . " ";
}
?>
The FOR loop can also be used in conjunction with a conditional, just like we did with the WHILE loop:
<?php
for ($num=1; $num <= 10; $num++ )
{
if ($num < 5)
{
print $num . " is less than 5 <br>";
}
else
{
print $num . " is not less than 5 <br>";
}
}
?>

