Lesson 22 of 3073%
(Progress persistence is disabled until Phase 9)
PHP
Beginner
Do While
Learn about Do While in PHP.
PHP is a powerful server-side language. In this lesson, we will cover Do While.
Real code examples
<?php
$x = 1;
do {
echo "The number is: $x \n";
$x++;
} while ($x <= 5);
// Note: do...while executes at least once even if condition is false
?>
Common mistakes
Make sure you include the <?php tag when writing PHP!
Try It Yourself
You can experiment with this in the Playground.