时间:2021-07-01 10:21:17 帮助过:94人阅读
arr1 = Array( [0] => 7 [1] => 100);arr2 = Array( [0] => 2 [1] => 8 [2] => 9 [3] => 1001 [4] => 7 );if( ){echo "arr2已包含了arr1中的值";}
交集非空
count(array_intersect($A, $B))>0
$arr1 = Array(7, 100);
$arr2 = Array(2, 8, 9, 1001, 7);
print_r(array_uintersect($arr1, $arr2, "strcasecmp"));
使用函数array_intersect 可以实现你要的功能.
交集一下就知道了。
$arr1 = array(1,2,3);$arr2 = array(1,3,4,5);check($arr1, $arr2);function check($arr1, $arr2){ $result = array_intersect($arr1, $arr2); print_r($result);}