➤ loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.
do {
  code to be executed;
} while (condition is true);
For instance:
$x = 1;
do {
  echo "The number is: $x \n";
  $x++;
} while ($x <= 2);
/* outputs    The number is: 1
              The number is: 2 */
              

$x = 10;
do {
  echo "The number is: $x \n";
  $x++;
} while ($x <= 2);
// outputs   The number is: 10
by Levani Makhareishvili
2 years ago
PHP
Loops
1
Pro tip: use ```triple backticks around text``` to write in code fences