Maybe I'm going insane, but I could have sworn that there was an PHP core function which took two arrays as arguments:
$a = array('1', '3');
$b = array('1'=>'apples', '2'=>'oranges', '3'=>'kiwis');
And performs an intersection where the values from array $a
are checked for collisions with the keys in array $b
. Returning something like
array('1'=>'apples', '3'=>'kiwis');
Does such a function exist (which I missed in the documentation), or is there a very optimized way to achieve the same thing?