一个循环判断进入了误区 请求指导
<?php<br />$str ="3,8,9,10,11,";<br />$array = explode(",", $str);<br />foreach($array AS $_key=>$value){ <br /> $show.="$value";<br />}<br />if($show==3){<br /> echo "你好";<br />}elseif($show==11){<br /> echo "我好"; <br />}else{<br /> echo "都好";<br />}<br />
$str ="3,8,9,10,11,";<br />$array = explode(",", $str);<br />foreach($array AS $_key=>$value){ <br /> if($value==3){<br /> echo "你好";<br /> }elseif($value==11){<br /> echo "我好"; <br /> }else{<br /> echo "都好";<br /> }<br />}
<br /><?php<br />echo '<meta http-equiv="content-type" content="text/html;charset=utf-8">';<br /><br />$str ="3,8,9,10,11,";<br />$array = explode(",", $str);<br />foreach($array AS $_key=>$value){ <br /> echo show($value);<br />}<br /><br />function show($v){<br /> if($v==3){<br /> return '你好 ';<br /> }elseif($v==11){<br /> return '我好 ';<br /> }else{<br /> return '都好 ';<br /> }<br />}<br />?><br />