`Say I have an associative array like so:
$array = array(
'names' => array('amy','john', 'peter'),
'places' => array('milan', 'venice', 'amsterdam'),
'uncategorized' => array('desk', 'plane', 'silly'),
'jobs' => array('singer', 'clerk', 'broker')
);
Now suppose I want to save uncategorized into a new array and remove it from $array
, I can do:
$uncategorized = $array['uncategorized'];
unset($array['uncategorized']);
My question is, is there any single function that does it kind of like how array_pop
returns the last value and shortens the array by that element?