|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-04-30 14:27 UTC] salathe@php.net
[2010-04-30 14:30 UTC] salathe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: salathe
[2010-04-30 14:30 UTC] salathe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 03:00:02 2026 UTC |
Description: ------------ The 3rd paragraph of documentation description states: "If only one array is given and the array is numerically indexed, the keys get reindexed in a continuous way." The "If only one array is given" is incorrect. I supplied two arrays, both numerically indexed, and the result was reindexed (as also shown in Example#3). The sentence implies this would not happen if multiple numerically indexed arrays were given because it says "if only one...". The documentation should state: "If one or more arrays are given in which all arrays contain only numeric keys, the array values are merged and the keys are reindexed starting with zero in a continuous way." or something to that effect. I realize Example #3 somewhat shows this by supplying two arrays one of which is empty and it shows the reindex. It would still be nice if the wording in the description above matched this. As you guessed, I read the doc description, used it, debugged my problem, and THEN noticed Example #3. Test script: --------------- $array1 = array(10=>'Ten',11=>'eleven'); $array2 = array(5=>'five',16=>'sixteen'); var_dump(array_merge($array1,$array2)); Expected result: ---------------- array(4) { [10]=> string(3) "Ten" [11]=> string(6) "eleven" [5]=> string(4) "five" [16]=> string(7) "sixteen" } Actual result: -------------- array(4) { [0]=> string(3) "Ten" [1]=> string(6) "eleven" [2]=> string(4) "five" [3]=> string(7) "sixteen" }