continue:跳出本次循環
break:終止循環
exit:用來結束程序執行
return: 用來結束一段代碼
$arr= array('le','yang','jun','lecode','gagade');
$html= '';
foreach($arr as $key => $value){
if($value=='b'){
$html.= $value;
continue;// 當 $value爲b時,跳出本次循環
}
if($value=='c'){
$html.= $value;
break;// 當 $value爲c時,終止循環
}
$html.= $value;
}
echo $html; // 輸出: abc