这段代码使用while语句对两个变量$i和$num分别进行递减和递加
<html> <body> <?php $i = 0; $num = 50; while( $i < 10) { $num--; $i++; } echo ("Loop stopped at i = $i and num = $num" ); ?> </body> </html>
输出结果
Loop stopped at i = 10 and num = 40
这段代码使用while语句对两个变量$i和$num分别进行递减和递加
<html> <body> <?php $i = 0; $num = 50; while( $i < 10) { $num--; $i++; } echo ("Loop stopped at i = $i and num = $num" ); ?> </body> </html>
输出结果
Loop stopped at i = 10 and num = 40