Given two arrays:
$foo = array('a', 'b', 'c');
$bar = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
Is there a built-in PHP function to produce the following result array?
$result = array('a' => 1, 'b' => 2, 'c' => 3);
I've been through the Array Functions list on php.net, but can't seem to find what I'm looking for. I know how to do it myself if need be, but I figured this might be a common-enough problem that there might be a built-in function that does it and didn't want to reinvent the wheel.
$bar
), but only the keys from the first array ($foo
). – drrcknlsn Jan 4 '12 at 14:40