James, My question had more to do with why the authors would give this usage when array_push is not documented to behave so (as you correctly described). Were they describing an earlier version of array_push? A simple buggy example? A typo perhaps?
Since the authors Hughes and Zmievski are big names in PHP, though mortals like you and me, I'm inclined to think they were thinking about something. ----- Original Message ----- From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, August 03, 2003 1:27 AM Subject: Re: [PHP] Pushing array onto array > On Sunday 03 August 2003 13:02, Hank TT wrote: > > Well, I might have been more specific about their example, since not > > everyone has the book. An excerpt below (so I don't need to retype all the > > names of characters and foul creatures from the Lord of the Rings): > > > > --------------------------- > > $arr1 = array('G', 'R', 'Sr'); > > $arr2 = array('N', 'Su', 'O'); > > > > $arr3 = array_push($arr1, $arr2); > > > > print $arr3[3][1]; > > //prints Su > > --------------------------- > > I don't see how your example could work. array_push() does NOT return an > array. The results of array_push() is placed in the first argument -- in this > case $arr1. > > > Weird usage.... > > Think of it like this -- it adds the 2nd array onto the 1st array. > > It does NOT add the *contents* of the 2nd array to the 1st array -- for that > you would probably use array_merge(). > > Do a print_r($arr1), it might help you visualise what happens. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > It is now pitch dark. If you proceed, you will likely fall into a pit. > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php