Do While Loop

Do While loop is similar to While loop  But the difference is that its an exit control loop . That means the code in the loop will get executed at least once

Syntax

Do{
//Block of codes
}while (condition)

Example

<?php
$i=6;
do{
echo $i++.” t”;
}while($i<=5)
?>

Output

6

You can see that even though the condition is not true it will print the first value

Share