[suspicious - maybe spam] Re: [PHP] How do I get the first element's key of an array of objects?
| From: | Mattias Thorslund | Date: | Fri, 08 Apr 2005 00:19:59 +0000 |
| Subject: | [suspicious - maybe spam] Re: [PHP] How do I get the first element's key of an array of objects? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-212601@lists.php.net to get a copy of this message | ||
Chris W. Parker wrote:
While looking through the array functions I saw www.php.net/array_keys and thought of: <?php $keys = array_keys($object_array); $first_key = $keys[0]; ?>I wonder if that will work, when the first element has the key 3... ? This might work better: $keys = array_keys($object_array); $first_key = reset($keys); /Mattias -- More views at http://www.thorslund.us