This question already has an answer here:
I need only array elements which have their keys in values of second array, with the fastest script.
$array_1 = array(
'ana' => 'are',
'du' => 34,
'bopq'=> "Ana are mere mereu",
13 => "OK"
);
$array_2 = array('du', 13);
$expected_array = array(
'du' => 34,
13 => "OK"
);
There is faster solution than:
$expected_array = array_intersect($array_1, array_combine($array_2, $array_2);
?
</div>