嗨我有两个数组
$arrays = Array ( [0] => 2 [1] => 3 ) ;
和
$result_array = Array (
[0] => Array ([0] => 1
[1] => sa
[2] => asa
[3] => sas
[4] => asa
[5] => ada
[6] => Y )
[1] => Array ([0] => 2
[1] => TEST1
[2] => TEST1
[3] => TEST1
[4] => TEST1
[5] => Coverage
[6] => Y )
[2] => Array ([0] => 3
[1] => TEST2
[2] => TEST2
[3] => TEST2
[4] => TEST2
[5] => Coverage
[6] => Y ) );
我想要实现的是从 $result_array 获取所有数组,其中应该包含 $arrays 的值
我试过了$new_array = array_intersect($arrays,$result_array);
和
foreach($result_array as $array)
{
for($i=0;$i<count($arrays);$i++)
{
echo $arrays[$i];
$key = array_search($array, $arrays[$i]);
$result = $array[$key];
}
break;
}
第二个给我这个错误Warning: array_search() [function.array-search]: Wrong datatype for second argument in D:\xampp\htdocs\WEB_1\index.php on line 96
还有其他方法可以实现这一目标吗?