时间:2021-07-01 10:21:17 帮助过:5人阅读
$a = 'abc123'; // 字符串如何匹配如下数组?Array( [0] => abc123 [1] => 1231231 [2] => 123123123 [3] => 222aads2 [4] => 23232 [8] => 222211 [9] => asfds) 个数 前后 字母 大小写 都要匹配 如果匹配其中一个返回 true 否则 返回 false
匹配是指在数组中?
in_array()?
$a = 'abc123';$arr = Array( 0 => 'abc123', 1 => '1231231', 2 => '123123123', 3 => '222aads2', 4 => '23232', 8 => '222211', 9 => 'asfds') ;if(in_array($a, $arr)){ echo '匹配成功';}else{ echo '匹配失败';}
$a = 'abc123';$arr = Array( 0 => 'abc123', 1 => '1231231', 2 => '123123123', 3 => '222aads2', 4 => '23232', 8 => '222211', 9 => 'asfds') ;if(in_array($a, $arr)){ echo '匹配成功';}else{ echo '匹配失败';}