note 98541 deleted from function.array-merge by danbrown
| From: | danbrown@php.net | Date: | Fri, 25 Jun 2010 15:20:36 +0000 |
| Subject: | note 98541 deleted from function.array-merge by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170453@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
please watch out with mixed keys, as the description says "If ALL of the arrays contain ONLY
numeric keys, the resulting array is given incrementing keys starting from zero." is not true.
it should say "If one of more arrays contain also numeric keys, the resulting array is given
incrementing keys starting from zero for the numeric keys, the string keys will stay as they
are."
<?php
array_merge(array('abc'=>'123','123'=>'abc'),array('abc'=>'456'))
// should give:
array('abc'=>'456','123'=>'abc')
// but is gives:
array('abc'=>'456','0'=>'abc')
?>