Home  >  Article  >  Backend Development  >  Detailed explanation of the difference between while and do...while in php

Detailed explanation of the difference between while and do...while in php

黄舟
黄舟Original
2017-07-28 11:00:231551browse

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.

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn