array (
50888 =>
array (
'ELEMENTS' =>
array (
0 => '1028',
1 => '1030',
),
),
50889 =>
array (
'ELEMENTS' =>
array (
0 => '1048',
),
),
50890 =>
array (
'ELEMENTS' =>
array (
0 => '1039',
),
),
)
array (
0 => '1028',
1 => '1039',
)
array (
0 => '50888',
1 => '50890',
)
$array1 = [];
$array2 = [];
$result = [];
$i = 0;
foreach ($array1 as $row){
foreach ($row as $row1){
if (in_array($row1, $array2)){
$result[$i] = $row;
$i += 1;
}
}
}
var_dump($result);
$array1 = array(50888 => array('ELEMENTS' => array('1028', '1030')),
50889 => array('ELEMENTS' => array('1048')),
50890 => array('ELEMENTS' => array('1039')),
);
$array2 = array('1028', '1039');
$array3 = array_reduce(array_keys($array1), function($carry, $key) use ($array1, $array2) {
if (count(array_intersect($array1[$key]['ELEMENTS'], $array2)) > 0)
$carry[] = $key;
return $carry;
}, array());