Difference Between while and do…while Loop: With a while loop, the condition to be evaluated is tested at the beginning of each loop statement, so if the conditional expression evaluates to false, the loop will never be executed.

With a do-while loop, on the other hand, the loop will always be executed once, even if the conditional expression is false, because the condition is evaluated at the end of the loop statement.

Example:

<?php

$i = 1;

do

{

$i++;

echo  $i . “<br>”;

}

while($i <= 3);

?>

 Output: 2 3 4