PHP continue 關鍵字
示例
使用 continue
跳過迴圈中的“5”部分程式碼
<?php
for($i = 1; $i <= 10; $i++) {
if($i == 5) {
continue;
}
echo "$i <br>";
}
?>
自己動手試一試 »
定義和用法
The continue
keyword is used to is used to end the current iteration in a for
, foreach
, while
or do..while
loop, and continues to the next iteration.
相關頁面
Use the break
keyword to end the loop completely
Read more about break and continue in our PHP Break and Continue Tutorial.
在我們的 PHP 迴圈教程 中閱讀有關迴圈的更多資訊。
❮ PHP 關鍵字