# PHP Do While Loop

PHP Do While Loop is a loop statement which is used to execute a block of code continuously as long as the condition of the loop is true, and stops only when the condition fails like other loop statements.

The unique feature of Do While loop is that it is used to execute a block of code at least once and then to repeat the actions as long as the specified condition is true.

Syntax:

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

Example 1: When the While condition is true

   "; $i++; } while ($i <= 10); ?>

Output

 1 2 3 4 5 6 7 8 9 10

Example 2: When the While condition is false

   "; $i++; } while ($i <= 20); ?>

Output

 21