php do / while循环
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php do / while循环相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html>
<head>
<link type='text/css' rel='stylesheet' href='style.css'/>
<title>More Coin Flips</title>
</head>
<body>
<p>We will keep flipping a coin as long as the result is heads!</p>
<?php
$flipCount = 0;
do {
$flip = rand(0,1);
$flipCount ++;
if ($flip){
echo "<div class=\"coin\">H</div>";
}
else {
echo "<div class=\"coin\">T</div>";
}
} while ($flip);
$verb = "were";
$last = "flips";
if ($flipCount == 1) {
$verb = "was";
$last = "flip";
}
echo "<p>There {$verb} {$flipCount} {$last}!</p>";
?>
</body>
</html>
以上是关于php do / while循环的主要内容,如果未能解决你的问题,请参考以下文章
php do / while循环
PHP循环 跳转 替代语法 函数 返回总结
PHP循环语句深度理解分析——while, for, foreach, do while
有没有办法在 PHP 中执行 do、while 循环时监听新的套接字连接?
PHP循环
入门6:PHP 语法基础——循环