public static function type($array)
	{
	    $last_key = -1;
	    $type = 'index';

	    foreach( $array as $key => $val )
	    {
	        if( !is_int( $key ) || $key < 0 )
	        {
	            return 'assoc';
	        }

	        if( $type !== 'sparse' ) 
	        {
		        if( $key !== $last_key + 1 ){
		            $type = 'sparse';
		        }
		        $last_key = $key;
		    }
	    }

	    return $type;
	}
public static function type($array)
	{
	    $last_key = -1;
	    $type = 'index';

	    foreach( $array as $key => $val )
	    {
	        if( !is_int( $key ) || $key < 0 )
	        {
	            return 'assoc';
	        }

	        if( $type !== 'sparse' ) 
	        {
		        if( $key !== $last_key + 1 ){
		            $type = 'sparse';
		        }
		        $last_key = $key;
		    }
	    }

	    return $type;
	}
public static function type ( $ array ) { $ last_key = - 1 ; $ type = 'index' ; foreach ( $ array as $ key => $ val ) { if ( ! is_int ( $ key ) || $ key < 0 ) { return 'assoc' ; } if ( $ type !== 'sparse' ) { if ( $ key !== $ last_key + 1 ) { $ type = 'sparse' ; } $ last_key = $ key ; } } return $ type ; }
Find whether the array is indexed or an associative array
If it is indexed, find if its sparse or not

@return string       type of array (index, assoc, sparse)
Find whether the array is indexed or an associative array If it is indexed find if its sparse or not