note 98541 added to function.array-merge
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 22 Jun 2010 00:55:58 +0000 |
| Subject: | note 98541 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170364@lists.php.net to get a copy of this message | ||
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')
?>
----
Server IP: 83.137.20.135
Probable Submitter: 94.214.177.253
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/98541
Del: integrated -- https://master.php.net/note/delete/98541/integrated
Del: useless -- https://master.php.net/note/delete/98541/useless
Del: bad code -- https://master.php.net/note/delete/98541/bad+code
Del: spam -- https://master.php.net/note/delete/98541/spam
Del: non-english -- https://master.php.net/note/delete/98541/non-english
Del: in docs -- https://master.php.net/note/delete/98541/in+docs
Del: other reasons-- https://master.php.net/note/delete/98541
Reject -- https://master.php.net/note/reject/98541
Search -- https://master.php.net/manage/user-notes.php