note 111351 added to function.array-merge
| From: | stein at visibone dot com | Date: | Mon, 11 Feb 2013 03:20:21 +0000 |
| Subject: | note 111351 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193572@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.199
Probable Submitter: 70.16.195.218
----
Manual Page -- http://php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/111351
Del: integrated -- https://master.php.net/note/delete/111351/integrated
Del: useless -- https://master.php.net/note/delete/111351/useless
Del: bad code -- https://master.php.net/note/delete/111351/bad+code
Del: spam -- https://master.php.net/note/delete/111351/spam
Del: non-english -- https://master.php.net/note/delete/111351/non-english
Del: in docs -- https://master.php.net/note/delete/111351/in+docs
Del: other reasons-- https://master.php.net/note/delete/111351
Reject -- https://master.php.net/note/reject/111351
Search -- https://master.php.net/manage/user-notes.php