|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-30 17:22 UTC] derick@php.net
[2002-07-02 16:04 UTC] eru@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 12:00:01 2025 UTC |
Lets consider that we have following arrays, $ar1 and $ar2: // first array $ar1 = array(); $ar1[1] = 'val1'; $ar1[2] = 'val2'; // second array $ar2 = array('key' => ''); Than we have resulting array $res. Let's lookwhat happend after array_merge() call: $res = array_merge($ar1, $ar2); var_dump($res); Resulting array is described here: array(3) { [0]=> string(4) "val1" [1]=> string(4) "val2" ["key"]=> string(0) "" } Numeric keys 1 and 2 was recoded to 0 and 1. Looks like bug, isn't it? I refer to the documentation, but there is nothing written about the numeric keys redefining. An exaple there (in documentation) shows example, where only numeric keys started from 0 are used, so no such change happened.