【PHP】使用array_intersect函数进行PHP数组比较
翻译如下:
程序代码
<?php
$data = [
['1','2','3','4','5']
,['88','288','83','84','85']
,['1','2','3','4','5']
];
$search = ['1','2','266'] ;
foreach ($data as $value){
if(array_intersect($search,$value)){
echo true;
}else{
echo 'false';
}
}
一种选择是:结果1
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
array(0) {
}
结果2:
array(0) {
}