PHP While Loop


PHP While Loop

Examples using the while loop with PHP.

Loop Syntax #1

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

Loop Syntax #2

$myvar = 1;
while($myvar < 5) {
echo $myvar."<br/>";
$myvar++;
}