Hello!
I'm fairly new to PHP and absolutely new to this mailing list.
I subscribed and I'm writing because I observed some strange behavior with
array_merge_recursive(). I'm using PHP version 4.1.2. Please look at the
following code:
$a = array('k' => array('a1'));
$b = array('k' => array('b1'));
$r = array_merge_recursive($a, $b);
echo count($a['k']), '<br>';
echo count($b['k']), '<br>';
This will print
2
1
Apparently $a['k'] has been merged with $b['k'] and $a['k'] has been set to
the resulting two-element array. I did not expect this behavior: I expected
the function to make a new array, which contains both 'a1' and 'b1'. Only
$r['k'] should refer to this new array.
Otherwise, in my opinion, array_merge_recursive should not return a value,
just modify the first argument.
Should I file a bug report about this?
Thank you,
Michiel van Wessem
Network Administrator
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php