Yasuo Ohgaki wrote:
> Markus Fischer wrote:
>
>> Can someone point me where the following behaviour is documented:
>>
>> $ php -q
>> <?
>> $foo = array(27 => 'Ene');
>> $bar = array(-1 => 'Mene');
>>
>> $baz = $foo + $bar;
>>
>> var_dump($baz);
>> ?>
>> array(2) {
>> [27]=>
>> string(3) "Ene"
>> [-1]=>
>> string(4) "Mene"
>> }
>>
>> cheers
>>
>> - Markus
>>
>>
>
> I guess it's not.
>
> There is note explains this behavior. Accoding to the note,
> "PHP Developer's Cookbook claims (p. 87 and sort of on p. 108)
> that '+' is syntactic sugar for array_merge."
>
Actually it's not really. It's similar -- but in this case array_merge()
would have re-ordered the keys to 0 and 1, whereas the '+' is more of an
array_merge_assoc() type function... it forces the merge to be treated as
associative.
--
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]