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

Reply via email to