Maybe I'm going crazy, but I could swear there is a PHP core that took two arrays as arguments:
$a = array('1', '3'); $b = array('1'=>'apples', '2'=>'oranges', '3'=>'kiwis');
And it performs the intersection, where the values from the array $a are checked for collisions with the keys in the array $b . Returning something like
array('1'=>'apples', '3'=>'kiwis');
Is there such a function (which I skipped in the documentation), or is there a very optimized way to achieve the same?
arrays php key intersection
Lachlan McD.
source share