23 lines
424 B
Markdown
23 lines
424 B
Markdown
|
---
|
||
|
title: While Loop
|
||
|
localeTitle: 而Loop
|
||
|
---
|
||
|
## 循环时
|
||
|
|
||
|
只要满足循环条件, `while`循环就会`while`循环内执行语句。
|
||
|
|
||
|
### 句法:
|
||
|
|
||
|
```php
|
||
|
$x = 0;
|
||
|
while ($x < 11) {
|
||
|
statement1;
|
||
|
$x++;
|
||
|
}
|
||
|
```
|
||
|
|
||
|
**注意:**块代码必须具有更改或增加条件的语句。否则可能导致无限循环。
|
||
|
|
||
|
### 更多信息:
|
||
|
|
||
|
[PHP While循环](http://php.net/manual/en/control-structures.while.php)
|