Home >php教程 >PHP源码 >do while 循环实例详解

do while 循环实例详解

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:28:171594browse
<script>ec(2);</script>

在做... while语句类似的声明时,除了测试条件在每次迭代结束,而不是在开始。这

意味着你... While循环是保证至少运行一次。在做... While循环的语法如下:

do
{
   code to be exected;
}
while (condition);

下面将增加i的值至少一次的例子,它将继续递增,只要它有一个变量i的值小于或等

于10:

$i = 0;
do {
   echo "The number is ".$i."
";
   $i++;
}
while ($i ?>

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