Is there a native PHP function for removing an element from an associative array, and returning the value?
Like unset()
but with a return value, or array_shift()
where you can specify the index to shift?
$element = unset($array['index']);
$element = array_shift($array, 'index');
I know it's easy to do, I'm just curious if there's an elegant one-liner for doing this.