removing an item from an array
| From: | Rasmus Schultz | Date: | Wed, 15 Aug 2012 20:18:21 +0000 |
| Subject: | removing an item from an array | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-62201@lists.php.net to get a copy of this message | ||
How come there is no straight-foward obvious way to simply remove a given
value from an array?
Just look at the number of horrible ways people solve this obvious problem:
http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
Shouldn't we have something simple, like:
array_remove($array, $value) : array (returns a new array)
and/or
array_delete(&$array, $value) : bool (modifies array directly)
?