login

PHP do while

PHP do while statement is similar to the while statement except that the code block is executed at least one. Here is the form of do while statement:

do{
   // code block to be executed 4     
}while(condition);

The code block in the do while statement is ran first then the condition is checked at the end of each iteration. If the iteration is still true, the code block run again and again until the condition is false. Here is an example of using do while statement.

Like while statement, do while statement can be nested in another do while statement.

DO WHILE LOOP