note 77729 deleted from function.array-splice by nlopess
| From: | nlopess@php.net | Date: | Tue, 11 Sep 2007 10:50:21 +0000 |
| Subject: | note 77729 deleted from function.array-splice by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130365@lists.php.net to get a copy of this message | ||
Note Submitter: bill at achieveinternet dot com
----
Note that it's a bit of a misnomer to say that array_unshift($input, $x, $y) is equivalent to
array_splice($input, 0, 0, array($x, $y)). While the 2 behave identically in other situations, they
behave differently if your array consists of only numeric keys. If you have a numeric-keyed array,
array_unshift will reorder your array indices while array_splice will not. If you're trying to
maintain the integrity of your indices, then, array_splice is what you should use.