Hi,
I came across a strange behaviour in array_merge since I installed php5.
I merge three arrays, one of them can be empty. So not an array at all.
In php 4.3.6 that I had before, there was no warning and the two first arrays were merged. In php5 on the other hand, there is a warning and my array is empty.
Is this behaviour wanted? Or is this just me having this problem?
I find it pretty ugly, either there is more than a warning, or at least the first two arrays should be merged and given back.


$array_1 = array('key1'=>'oranges','key2'=>'apples');

        $array_2 = array('key3'=>'pears','key4'=>'tomatoes');
        $array_3 = null;
        $arr_gemerged = array_merge($array_1,$array_2,$array_3);

        print_r($arr_gemerged);

Result on php4:
Array ( [key1] => oranges [key2] => apples [key3] => pears [key4] => tomatoes )



Result on php5:
Warning: array_merge() [function.array-merge]: Argument #3 is not an array in /Library/WebServer/Documents/regis24/admin/test_array_merge.php on line 7



I would define this behaviour as backwards incompatible. How about you?


Sebastian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to