Created
February 4, 2014 09:14
-
-
Save dapepe/8800413 to your computer and use it in GitHub Desktop.
Checks if an array is associative or numeric
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 | |
/** | |
* Checks if an array is associative or numeric | |
* | |
* @param array $arr | |
*/ | |
function isAssoc($arr) { | |
return is_array($arr) ? (array_keys($arr) !== range(0, count($arr) - 1)) : false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment