PHP鎺у埗缁撴瀯涔媌reak


break 缁撴潫褰撳墠 for锛宖oreach锛寃hile锛宒o-while 鎴栬 switch 缁撴瀯鐨勬墽琛屻

break 鍙互鎺ュ彈涓涓彲閫夌殑鏁板瓧鍙傛暟鏉ュ喅瀹氳烦鍑哄嚑閲嶅惊鐜

<?php
$arr = array('one', 'two', 'three', 'four', 'stop', 'five');
while (list (, $val) = each($arr)) {
    if ($val == 'stop') {
        break;    /* You could also write 'break 1;' here. */
    }
    echo "$val<br /> ";
}

/* 浣跨敤鍙夊弬鏁 */

$i = 0;
while (++$i) {
    switch ($i) {
    case 5:
        echo "At 5<br /> ";
        break 1;  /* 鍙鍑 switch. */
    case 10:
        echo "At 10; quitting<br /> ";
        break 2;  /* 閫鍑 switch 鍜 while 寰幆 */
    default:
        break;
    }
}
?>

浠ヤ笂灏辨槸PHP鎺у埗缁撴瀯涔媌reak鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒



鏈枃URL锛http://www.odweb.cn/news_show.html?id=81