Repeat

Do While Loop

PHP

 

Do While loop

PHP 5
$count = 5;

do {
    $count--;
    print($count);
} while($count > 0);

The code inside the do-while block runs as long as the condition count > 0 evaluates to true.

The difference between do-while and while is that, in do-while the block is first run and then the condition is checked.

This means that no matter what do-while condition is, the block will always run at least once.

This will print 4 3 2 1 0 on Console.