note 22151 added to function.array-splice
| From: | kokos at lac dot lviv dot ua | Date: | Sat, 08 Jun 2002 06:55:40 +0000 |
| Subject: | note 22151 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31595@lists.php.net to get a copy of this message | ||
To paule@cs.tamu.edu :
Sorry, but the fix will still not work properly - when $length=0 (e.g. trying to insert one value)
the
$new_array[$key]=$replacement;
would be immediately followed by
$new_array[$key]=$value;
and the $replacement will be lost.
What i was trying to point out in my original post is that $input[$x]=$y is NOT equivalent to
array_splice($input, $x, 1, $y) . The equivalence mentioned would be true ONLY when $input is
<... ghmm... > "automatically enumerated", having its' keys exactly matching
offsets of corresponding elements in the array. But, in general case, keys do not match offsets -
perhaps this should be explicitly stated in the Description above.
--
http://www.php.net/manual/en/function.array-splice.php
http://master.php.net/manage/user-notes.php?action=edit+22151
http://master.php.net/manage/user-notes.php?action=delete+22151
http://master.php.net/manage/user-notes.php?action=reject+22151