Created
May 11, 2016 08:23
-
-
Save Aleksandr-ru/d5f6797638137fcbe33cbb65f36ceeb0 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Проверяет наличие строковых ключей в массиве | |
* @param array $arr | |
* @return bool | |
* @link http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential | |
*/ | |
function is_assoc($arr) | |
{ | |
if(!is_array($arr)) { | |
trigger_error("Argument should be an array for is_assoc", E_USER_WARNING); | |
return FALSE; | |
} | |
return count(array_filter(array_keys($arr), 'is_string')) > 0; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment