The PHP do-while loop is guaranteed to run at least once. It executes the code at least one time always because the condition is checked after executing the code.
The do-while loop is very much similar to the while loop except the condition check.
Syntax
do{
//code to be executed
}while(condition);
Flowchart
Example
<?php
$n=1;
do{
echo "$n";
$n++;
}while($n<=5);
?>
A semicolon is used to terminate the do-while loop.