I have at least two arrays (actually four+):
$first_names = array(
'0' => 'Jon'
'1' => 'David'
);
$last_names = array(
'0' => 'Schumacher'
'1' => 'Johnson'
);
And need to produce:
$full_names = array(
'0' => array('first' => 'Jon', 'last' => 'Schumacher')
'1' => array('first' => 'David', 'last' => 'Johnson')
);
Do not need to preserve original keys (but of course, would prefer to. Need to do this for more than 4 arrays.
Am having trouble finding the ‘best’ solution (could pop off of each, but that seems likely to produce errors to me).
you should try array_map: