note 77729 added to function.array-splice

From: Date: Mon, 10 Sep 2007 23:33:42 +0000
Subject: note 77729 added to function.array-splice
Groups: php.notes 
Request: Send a blank email to php-notes+get-130349@lists.php.net to get a copy of this message
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. ---- Server IP: 208.69.120.35 Probable Submitter: 209.126.158.254 ---- Manual Page -- http://www.php.net/manual/en/function.array-splice.php Edit -- https://master.php.net/note/edit/77729 Del: integrated -- https://master.php.net/note/delete/77729/integrated Del: useless -- https://master.php.net/note/delete/77729/useless Del: bad code -- https://master.php.net/note/delete/77729/bad+code Del: spam -- https://master.php.net/note/delete/77729/spam Del: non-english -- https://master.php.net/note/delete/77729/non-english Del: in docs -- https://master.php.net/note/delete/77729/in+docs Del: other reasons-- https://master.php.net/note/delete/77729 Reject -- https://master.php.net/note/reject/77729 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130349) next »