PHP while Loop with code
while - loops run a set of code as the condition is true.
Basic Syntax
while (condition)
{
code for executed;
}
<?php
$k=1;
while($k<=5) {
echo "The number is: $k <br>";
$k++;
}
?>
$k start with 1 and run 5 times as the k++
It continues to loop through the code until the condition becomes false.