1层循环
1层循环
2层循环
1层循环
1层循环
2层循环
3层循环
1层循环
数字:0
跳出2层循环,输出:3层循环
<?php
for ($i=1;$i<3;$i++){
for ($j = 1;$j<3;$j++){
for ($z=1;$z<3;$z++){
$num = getNum();
$zd[$num]++;
if($zd[$num] == 3){
echo "数字:".$num."<br/>";
echo "跳出2层循环,输出:";
break 2;
}
echo "1层循环<br/>";
}
echo "2层循环<br/>";
}
echo "3层循环<br/>";
}
function getNum(){
return rand(0,3);
}
?>
1层循环
2层循环
1层循环
1层循环
2层循环
3层循环
1层循环
数字:0
跳出2层循环,输出:3层循环
<?php
for ($i=1;$i<3;$i++){
for ($j = 1;$j<3;$j++){
for ($z=1;$z<3;$z++){
$num = getNum();
$zd[$num]++;
if($zd[$num] == 3){
echo "数字:".$num."<br/>";
echo "跳出2层循环,输出:";
break 2;
}
echo "1层循环<br/>";
}
echo "2层循环<br/>";
}
echo "3层循环<br/>";
}
function getNum(){
return rand(0,3);
}
?>