The while loop executes a block of code while a condition is true.while loop is also called entry control loop it means it check condition first after executes block of code the following initialization ans example of while loop.
<?php
while(condition)
{
code to be expanded
increment-decrement
}
?>
<?php
$a=1;
while($a<=5)
{
echo $a."
";
$a++;
}
?>
1
2
3
4
5