Last active
October 25, 2015 06:05
-
-
Save oppara/102084 to your computer and use it in GitHub Desktop.
php: is assoc array
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 | |
/** | |
* is assoc array | |
* | |
* @see http://jp.php.net/manual/ja/function.is-array.php | |
* @param array $a | |
* @access public | |
* @return bool | |
*/ | |
function is_assoc_array( $a ) { | |
return is_array( $a ) && ( count( $a ) !== array_reduce( array_keys( $a ), create_function( '$a, $b', 'return ($b === $a ? $a + 1 : 0);' ), 0 ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment