PHP COURSE • LESSON 15
PHP While Loop
A while loop executes code repeatedly while a condition is true.
while.php
<?php
$x = 1;
while($x <= 5){
echo $x;
$x++;
}
?>
Output
1 2 3 4 5