The following example demonstrates a while loop that will continue to run as long as the variable i is less than, or equal to 5. i will increase by 1 each time the loop runs:

<html>
<body>
<?php
$i=1;
while($i<=5)
{
echo "The number is " . $i . "<br />";
$i++;
}
?></body>
</html>

(from w3schools.com)

Do...While

Table of Contents