在PHP中使用goto方法去进行截至跳转
直接上线代码案例:
$number = 1;
switch($munber){
case 1:
goto one:
echo "frist one";
case 2:
goto two:
echo "second two"
case3:
goto three:
echo "third three";
}
one:
echo " 武林第一!";
//exit;
two:
echo " 武林第二!";
//exit;
three:
echo " 武林第三!";
//exit;
/*
最终结果是:武林第一! 武林第二! 武林第三!
注意后面的exit 注释了,为何不是最终输出 武林第一,大家可以琢磨下。
*/