<img src="https://img-blog.csdn.net/20140703205418750?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjXzEyM19saW5iaW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /><?php
echo "<h2> 特殊的流程控制语句</h2>" ;
for($i=1;$i<=10;$i++)
{
if($i==6)
{
continue;//结束本次循环,继续下一次循环
}
echo $i." ";
}
echo "<hr/>";
for($j=0;$j<=10;$j++)
{
if($j==6)
{
break;// 终止本次循环
}
echo $j." ";
}
echo "<hr/>";
$i=1;
for(;$i<=10;$i++)
{
for($k;$k<=10;$k++)
{
echo $k." ";
if(($i==5)&&($k==5))
{
break 2;//跳出两层循环之外,即连续终止2层循环
}
}
$k=1;
echo "<br/>";
}
echo "<hr/>";
$i=1;
$k=1;
for(;$i<=10;$i++)
{
for($k;$k<=10;$k++)
{
echo $k." ";
if(($i==5)&&($k==5))
{
continue 2;//结束第二层循环,继续下一次循环
}
}
$k=1;
echo "<br/>";
}
exit("退出!");//彻底终止脚本程序的执行
echo "over";
?>