Created
February 11, 2014 07:49
-
-
Save CarpeNoctem/8930726 to your computer and use it in GitHub Desktop.
PHP function I needed, that I thought might be useful for others as well. Like array_pop(), but for a specific array element instead of the very last one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Dec 2013 - CarpeNoctem | |
// Like array_pop(), for a specific array element instead of the very last one. | |
function pull(&$array,$key) | |
{ | |
$ret = $array[$key]; | |
unset($array[$key]); | |
return($ret); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment