Detect if array is indexed or associative

Possible duplicate:
PHP arrays: a good way to check if an array is associative or sequential?

What would be the most efficient way to check if an array is associative or not in PHP?

+5
source share
3 answers

If it is necessary to iterate through an array to be safe, you can always use foreach.

0
source
is_int(key($someArray))
-1
source

PHP .

-6

All Articles