How to use PHP Do While | Structure and Usage of PHP Do while loop

The Do While Loop

The PHP While loop is used to execute a block of code until given condition is true, i.e. loop till certain criteria is keep on meeting. Whereas The do…while  loop type statement will execute a block one time at least- it then will go through execute code and loop till specified condition is true. This is the only difference between While loop and do…While loop

Structure of Do…While in PHP

do

{

//block of code here;

Increment;

}while (condition);

Example of Do While



More real example



Other Loops:  For Loop While Loop |  Foreach Loop


Was this article helpful?

Related Articles

Leave A Comment?