Example
Use a while loop to print numbers from 1 to 5:
html
<?php
$i = 1;
while($i <= 5) {
echo $i;
echo "<br>";
$i++;
}
?>
Definition and Usage
The while keyword is used to create a while loop and is also used to set the looping condition of a do...while.
Related Pages
The do keyword.