PHP While

It executes a block of code as long as a specified condition evaluates to true. if the condition becomes false, the statements within the loop stop executing.

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

Output:

1
2
3
4
5