PHP Do While Loop

PHP do while loop is used to execute the code at least one time because condition is checked after executing the code. Syntax:

do{
//code to be executed 
}while(condition);
Output
<?php
$n=1; 
do{
echo "$n<br/>"; 
$n++; 
}while($n<=5); 
?>
Output 1 2 3 4 5



ADVERTISEMENT
ADVERTISEMENT