in_array变量赋值被当成一个值,求解决方法
in_array变量赋值被当成一个值,求解决方法
具体请看以下代码:
<br /> <?php<br /> //$meb['learned']数据库取值为:排舞,街舞,主持人,讲师<br /> $learn = explode(',',$meb['learned']);<br /> //echo $learn[0].$learn[1].$learn[2].$learn[3].$learn[4].$learn[5];<br /> $strp = str_replace(',', '", "', $meb['learned']);<br /> $strp2 = '"'.$strp.'"';<br /> $people = array($strp2);<br /> print_r($people); <br /> //以上输出结果为 Array ( [0] => "排舞", "街舞", "主持人", "讲师" ) <br /> if (in_array('讲师',$people)){<br /> echo "Match found";<br /> }<br /> else<br /> {<br /> echo "Match not found";<br /> }<br /> ?><br />