Here's an example of related activities (4.1.1):

<?php
  $a = array(4 => '4 a', 2 => '2 a', 'foo' => 'foo a');
  $b = array(4 => '4 b', 1 => '1 b', 'foo' => 'foo b');

  $c['plus']             = $a + $b;
  $c['merge']            = array_merge($a,$b);
  $c['merge_recursive']  = array_merge_recursive($a,$b);
  $c['concat']           = $a . $b;

  print_r($c);
?>

The behavior of . both seems weird yet mostly makes sense too.  I agree,
the use of '+' needs to be documented.  Documented with
similarities/differences between array_merge and array_merge_recusive.  
Some obvious differences can be seen through the above example, who will
document this and where? :)

I just reported bug #14990 on array_merge_recursive which may be of
interest.  Without further ado, here's the output from the above code:

Array
(
    [plus] => Array
        (
            [4] => 4 a
            [2] => 2 a
            [foo] => foo a
            [1] => 1 b
        )

    [merge] => Array
        (
            [0] => 4 a
            [1] => 2 a
            [foo] => foo b
            [2] => 4 b
            [3] => 1 b
        )

    [merge_recursive] => Array
        (
            [0] => 4 a
            [1] => 2 a
            [foo] => Array
                (
                    [0] => foo a
                    [1] => foo b
                )

            [2] => 4 b
            [3] => 1 b
        )

    [concat] => ArrayArray
)


Regards,
Philip Olson




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to