NYCPHP Meetup

NYPHP.org

[nycphp-talk] Need to get last element of 2-dimensional array

suzerain.studios suzerain at suzerain.com
Sat Sep 28 21:07:12 EDT 2002


hey:

remember, arrays begin at zero, so you need to subtract one from the 
result of sizeof() or count() in this case.

so, your answer is:

echo $idArray[0][(count($idArray[0])-1)];

Cheers,

Marc Antony Vose
http://www.suzerain.com/

Why is the alphabet in that order?  Is it because of that song?
-- George Carlin


>The following produced a rather nasty parse error:
>
>echo ($idArray[0][sizeof($idArray[0])]));
>
>I have a 2-dimensional array $idArray that I must obtain the LAST 
>element of that 2-dimensional array.. how do I do it?



More information about the talk mailing list