note 10243 modified in function.array-merge by danbeck
| From: | danbeck@php.net | Date: | Wed, 13 Mar 2002 15:56:09 +0000 |
| Subject: | note 10243 modified in function.array-merge by danbeck | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-27740@lists.php.net to get a copy of this message | ||
As rlynch@ignitionstate.com states, array_merge kills all integer keys and generates new ones.
I've found, that this only happens with values less than 2^31-1 (signed integer). If you use
keys greater than 2^32 php recognizes this a strings and leave the keys unchanged. I've you
want to preserve the keys, it is recommended to add a string prefix and remove it after merging
with, for example, array_walk().
Maybe, for someone this is great feature to clean up an numeric organized array.
Joerg Krause
www.php.comzept.de
--was--
As rlynch@ignitionstate.com statet, array_merge kills all integer keys and generates new ones.
I've found, that this only happens with values less than 2^31-1 (signed integer). If you use
keys greater than 2^32 php recognizes this a strings and leave the keys unchanged. I've you
want to preserve the keys, it is recommended to add a string prefix and remove it after merging
with, for example, array_walk().
Maybe, for someone this is great feature to clean up an numeric organized array.
Joerg Krause
www.php.comzept.de
http://www.php.net/manual/en/function.array-merge.php