Tuesday, June 2, 2009

PHP -While Loop

Here is the basic structure of a PHP while loop:

while ( conditional statement is true){
//do this code;
}
Example - Print number through 1 to 5 with PHP While Loop
<?php

$i = 1;
while ($i <= 5 )
{
echo $i . "<br>";

$i = $i + 1;
}

?>