break的应用.

break的应用.

 

<?php
/**
 * QQ:5871029 Email:hel8@vip.qq.com
 * @copyright Horleun (c)2010
 * @author Horleun <Horleun@foxmail.com>
 */
$i=0;
while(++$i)
{
    switch($i)
    {  case 2:echo”This is 2!”;
        break 1;

        case 6:echo “Now it is 6!”;
        break 2;//跳出2层,即跳出switch和while!

        default:
        break;
    }

}
?>

break语句的应用学习!

break后面的数字为跳出层数~

留下回复