note 107590 deleted from function.array-merge by salathe
| From: | salathe@php.net | Date: | Mon, 06 Sep 2021 22:46:18 +0000 |
| Subject: | note 107590 deleted from function.array-merge by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216899@lists.php.net to get a copy of this message | ||
Note Submitter: alejandro dot anv at gmail dot com
----
WARNING: numeric subindexes are lost when merging arrays.
Check this example:
$a=array('abc'=>'abc','def'=>'def','123'=>'123','xyz'=>'xyz');
echo "a=";print_r($a);
$b=array('xxx'=>'xxx');
echo "b=";print_r($b);
$c=array_merge($a,$b);
echo "c=";print_r($c);
The result is this:
c=Array
(
[abc] => abc
[def] => def
[0] => 123
[xyz] => xyz
[xxx] => xxx
)