|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-05-13 07:53 UTC] nicolas at van-lancker dot be
This is what the documentation says : If you omit a key, the maximum of the integer-indices is taken, and the new key will be that maximum + 1. As integers can be negative, this is also true for negative indices. Having e.g. the highest index being -6 will result in -5 being the new key. If no integer-indices exist yet, the key will be 0 (zero). My code : <?php $arr[-6] = "me"; $arr[] = "you"; ?> "you" is not stored in $arr[-5] but in $arr[0] $arr[-4] does not exist... This behaviour is undesired I guess... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jun 04 14:00:01 2026 UTC |
With latest CVS I get this: array(2) { [-6]=> string(2) "me" [0]=> string(3) "you" } Obvious bug..but should it be fixed is another question. (the backwards-compatibility hell..)