$arr = array('a','b','c','d','e');
$html = '';
foreach($arr as $key => $value){
if($value=='b'){
$html .= $value;
continue;
}
// 当 $value为b时,跳出本次循环,下面的代码不会被执行。
if($value=='c'){
$html .= $value;
break;
}
// 当 $value为c时,终止整个循环,也就是foreach停止运行。
$html .= $value;
}
echo $html; // 输出: ab