|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-05 14:59 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ When I create an array using the following code the array is corrupted for some reason, as if the double digits were misinterpreted or misread at some point. From my experience it happens specifically on index 08 and 09 (which are set to 0) Even if the order is different. The consequence is that data with index 08 will be overwritten by 09 or 09 will be overwritten by 08 if 08 is set after 09. Example code: Reproduce code: --------------- $list = array(); $list[01]='a'; $list[02]='b'; $list[03]='c'; $list[04]='d'; $list[05]='da'; $list[06]='db'; $list[07]='dc'; $list[08]='e'; $list[09]='ea'; $list[10]='eb'; $list[11]='ec'; $list[12]='f'; echo '<pre>'; var_dump($list); echo '</pre>'; Expected result: ---------------- array(11) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" [4]=> string(1) "d" [5]=> string(2) "da" [6]=> string(2) "db" [7]=> string(2) "dc" [8]=> string(2) "e" [9]=> string(2) "ea" [10]=> string(2) "eb" [11]=> string(2) "ec" [12]=> string(1) "f" } Actual result: -------------- array(11) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" [4]=> string(1) "d" [5]=> string(2) "da" [6]=> string(2) "db" [7]=> string(2) "dc" [0]=> string(2) "ea" //<- Here 09 overwrote 08 which was also set to 0 by the parser/interpreter? [10]=> string(2) "eb" [11]=> string(2) "ec" [12]=> string(1) "f" }