Get first key in a (possibly) associative array?
What's the best way to determine the first key in a possibly associative array? My first thought it to just foreach the array and then immediately breaking it, like this: foreach ($an_array as $key => $val) break; Thus having $key contain the first key, but this seems inefficient. Does anyone have a better solution?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.