I have two arrays which looks like:
$fields = array('id', 'name', 'city', 'birthday', 'money');
$values = array('id' => 10,
'name' => 'Jonnas',
'anotherField' => 'test',
'field2' => 'aaa',
'city' => 'Marau',
'field3' => 'bbb',
'birthday' => '0000-00-00',
'money' => 10.95
);
Is there a PHP built-in function which retrieves an array filled only with the keys specified on $fields
array (id, name, city, birthday, money)
?
The return I expect is this:
$values2 = array(
'id' => 10,
'name' => 'Jonnas',
'city' => 'Marau',
'birthday' => '0000-00-00',
'money' => 10.95
);
P.S.: I'm looking for a built-in function only.