Bug #13478: array_merge changes keys
| From: | nick at macaw dot demon dot co dot uk | Date: | Fri, 28 Sep 2001 12:19:02 +0000 |
| Subject: | Bug #13478: array_merge changes keys | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-66765@lists.php.net to get a copy of this message | ||
From: nick@macaw.demon.co.uk
Operating system:
PHP version: 4.0.6
PHP Bug Type: Arrays related
Bug description: array_merge changes keys
Found in 4.0.7RC2 but probably present before. Array merge changes keys
that are string-numeric. e.g.
<?
$arr1 = array('1'=>'one', '2'=>'two');
$arr2 = array('a'=>'all');
print_r(array_merge($arr1, $arr2));
?>
gives:
Array ( [0] => one [1] => two [a] => all )
A workaround kludge is to prefix string-numeric keys with a letter.
--
Edit bug report at: http://bugs.php.net/?id=13478&edit=1