Home >> Snippet List >> Snippet

Name
Check if array is associative
Description
The is_assoc_array function checks if given array is associative or not
PHP Snippet
<?PHP
 
FUNCTION is_assoc_array($array){
    IF(IS_ARRAY($array) && !IS_NUMERIC(ARRAY_SHIFT(ARRAY_KEYS($array)))){
        RETURN TRUE;
    }
    RETURN FALSE;
}
 
?>