note 111351 deleted from function.array-merge by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Mar 2013 16:07:57 +0000 |
| Subject: | note 111351 deleted from function.array-merge by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193916@lists.php.net to get a copy of this message | ||
Note Submitter: stein at visibone dot com
----
CAUTION: "numeric" in the description means something different than is_numeric() or
gettype(). It includes strings containing all digits!
"numeric" keys append:
<?php
assert(array(0=>0,1=>1) === array_merge(array(9=>0), array(9=>1)));
assert(array(0=>0,1=>1) === array_merge(array('9'=>0),
array('9'=>1)));
?>
non-"numeric" keys overwrite:
<?php
assert(array('z'=>1) === array_merge(array('z'=>0),
array('z'=>1)));
?>
Both bishop and nzujev point this out, but I thought it bore special emphasis.