时间:2021-07-01 10:21:17 帮助过:15人阅读
代码链接:http://www.mcqyy.com/RunCode/php/#id/29b4699b9f37cc352dcf1e39c7491e86
代码:
"; echo "arr:"; print_r($arr); echo "
"; echo $el.":"; if(array_search($el,$arr)){ echo 'yes'; }else{ echo 'no'; }}?>
结果是:
arr:Array ( [0] => 1 )
1:no
arr:Array ( [0] => 1 [1] => 2 )
2:yes
arr:Array ( [0] => 1 [1] => 2 )
1:no
ps:刚学php,还请大家指教。