RE: [PHP] How To Get Last Item Of An Array?

From: Date: Wed, 25 Dec 2002 20:27:37 +0000
Subject: RE: [PHP] How To Get Last Item Of An Array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-129328@lists.php.net to get a copy of this message
> I have an multi-dimensional array called $cat_data, which is info > extracted > from a MySQL DB. I want to retrieve the very last item of that array. How > would I do that? I know the first item can be retrieved by simply asking > for > $cat_data[0][0], which contains an id number. But I can't figure out how > to > get the last item in that same array -- $cat_data[x][0] where x is the > last > item in the array. Kind of begs the question of why can't you just select what you need with the proper query, instead of loading everything into an array... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#129328) next »