这段php代码使用while语句循环对变量$i进行累加,当$i=3时退出循环
<html>
<body>
<?php
$i = 0;
while( $i < 10)
{
$i++;
if( $i == 3 )break;
}
echo ("Loop stopped at i = $i" );
?>
</body>
</html>
输出结果如下:
Loop stopped at i = 3
这段php代码使用while语句循环对变量$i进行累加,当$i=3时退出循环
<html>
<body>
<?php
$i = 0;
while( $i < 10)
{
$i++;
if( $i == 3 )break;
}
echo ("Loop stopped at i = $i" );
?>
</body>
</html>
输出结果如下:
Loop stopped at i = 3