时间:2021-07-01 10:21:17 帮助过:7人阅读
$str ="3,8,9,10,11,";
$array = explode(",", $str);
foreach($array AS $_key=>$value){
$show.="$value";
}
if($show==3){
echo "你好";
}elseif($show==11){
echo "我好";
}else{
echo "都好";
}
$str ="3,8,9,10,11,";
$array = explode(",", $str);
foreach($array AS $_key=>$value){
if($value==3){
echo "你好";
}elseif($value==11){
echo "我好";
}else{
echo "都好";
}
}
echo '';
$str ="3,8,9,10,11,";
$array = explode(",", $str);
foreach($array AS $_key=>$value){
echo show($value);
}
function show($v){
if($v==3){
return '你好 ';
}elseif($v==11){
return '我好 ';
}else{
return '都好 ';
}
}
?>