Home >Backend Development >PHP Tutorial >Detailed explanation of the difference between while and do...while in php
This tutorial will talk about the difference between do while and while loop statements commonly used in PHP programming. While is executed when the condition is true, while do while will be executed at least once. Let’s take a look
do { }while(条件)
Look at the example of do while.
<? $a =10; do { echo $a; }while ($a>11)
10 will be output here; and then the loop will terminate, so let’s take a look at the while instance.
$a=10; while($a>11){ echo $a; }
There will be no output here, now you understand what it means.
The above is the detailed content of Detailed explanation of the difference between while and do...while in php. For more information, please follow other related articles on the PHP Chinese website!