Create a loop that always runs at least once:
<?php
$i = 5;
do {
echo $i;
echo "<br>";
$i--;
} while($i > 6);
?>
Try it Yourself »
The do
keyword creates a loop which always runs at least once. It is used together with the while
keyword to create a do...while
loop.
The while
keyword.
Read more about do...while loops in our PHP do while Loop Tutorial.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!