Created
March 1, 2011 22:59
-
-
Save jeffgca/850084 to your computer and use it in GitHub Desktop.
handy function to test the associative-ness of an array in PHP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function is_assoc($arr) { | |
| return array_keys($arr) !== range(0, count($arr) - 1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment