Suppose I have an array of records, keyed by some ID, and I use the array_column()
function to extract one piece of data from each record.
$records = array(
1234 => array(
'first_name' => 'John',
'last_name' => 'Doe',
),
4567 => array(
'first_name' => 'Sally',
'last_name' => 'Smith',
),
);
The result from array_column($input, 'first_name')
is a numerically indexed array (with new keys 0, 1, ...). Is there a way of keeping the keys from the input array?