:::

13. do/while

<?php
$i = 0;
do {
    echo $i;
} while ($i > 0);
?>

This do / while loop only runs once and then exits:

  1. First we set $i equal to 0.
  2. Second, the loop runs once and outputs $i, which is 0.
  3. Then the condition while ($i >0); is checked. Since $i is not greater than 0, the condition evaluates tofalseand thedo/while` loop stops.

:::

語系選擇