Created
August 22, 2016 20:43
-
-
Save alexsasharegan/81f7743bd3585771ad380812f75ce4ee to your computer and use it in GitHub Desktop.
Test an array to see if an associative array (returns true), or a numerically indexed array (returns false)
This file contains 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 | |
# From Stack Overflow | |
# http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential | |
function isAssoc($array) { | |
return array_keys($array) !== range(0, count($array) - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment