On Fri, Jan 11, 2002 at 01:28:32PM +0900, Yasuo Ohgaki wrote : 
> Markus Fischer wrote:
> 
> >On Thu, Jan 10, 2002 at 05:58:28PM -0700, Zak Greant wrote : 
> >
> >>On 2002-10-01 17:33, 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."
> >>>
> >> Also, there have been discussions on Dev about this issue before.
> >> Might be a bit tough to find though. :)
> >>
> >
> >    Hmm .. well, at least, it should be clearly documented.
> >
> >
> 
> I think it should be documented, unless "+" is going
> to be depreciated. (I hope it's not ;)

    Well, in fact, this is the only way to 'really concatenate'
    two arrays (which is extremely useful if you have an existing
    hash and just want to add a key/value pair at the beginning
    or at the end). array_merge() can't help you and right now I
    couldn't find any other array_*() function which helped me.

    And I'm certainly not interested in writing a while(.. each()
    construct or so or re-create a new array.

-- 
Please always Cc to me when replying to me on the lists.

-- 
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