Bug #12480: array_merge_recursive() clobbers existing numeric keys

From: Date: Tue, 31 Jul 2001 09:14:43 +0000
Subject: Bug #12480: array_merge_recursive() clobbers existing numeric keys
Groups: php.dev 
Request: Send a blank email to php-dev+get-61618@lists.php.net to get a copy of this message
From: pgl@instinct.org Operating system: FreeBSD PHP version: 4.0.6 PHP Bug Type: Arrays related Bug description: array_merge_recursive() clobbers existing numeric keys if any of the keys of the first level of arrays are numeric, using array_merge_recursive() will renumber them to start at 0. this destroys keys that are used to record id numbers, etc. [mini:pgl]:~/public_html $ cat test.php #!/usr/local/bin/php -q <? $b[a][4] = 1; $a[3][4] = 2; print_r(array_merge_recursive($a, $b)); ?> [mini:pgl]:~/public_html $ ./test.php Array ( [0] => Array ( [4] => 2 ) [a] => Array ( [4] => 1 ) ) -- Edit bug report at: http://bugs.php.net/?id=12480&edit=1

« previous php.dev (#61618) next »