Re: array question

From: Date: Mon, 10 Mar 2003 15:35:08 +0000
Subject: Re: array question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-138963@lists.php.net to get a copy of this message
On Monday 10 March 2003 21:13, Diana Castillo wrote: > If I sort an array, and now the keys are not in numerical order, how can I > get the key of the first element? > If I do array_shift I get the first element but I want that key. Not very elegant -- there must be a better way? foreach ($doo as $key => $value) { print "Key:$key Value:$value"; break; } -- 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 ------------------------------------------ /* Questionable day. Ask somebody something. */

« previous php.general (#138963) next »