public static function dimensions(array $data)
    {
        if (empty($data)) {
            return 0;
        }
        reset($data);
        $depth = 1;
        while ($elem = array_shift($data)) {
            if (is_array($elem)) {
                $depth += 1;
                $data =& $elem;
            } else {
                break;
            }
        }
        return $depth;
    }
public static function dimensions(array $data)
    {
        if (empty($data)) {
            return 0;
        }
        reset($data);
        $depth = 1;
        while ($elem = array_shift($data)) {
            if (is_array($elem)) {
                $depth += 1;
                $data =& $elem;
            } else {
                break;
            }
        }
        return $depth;
    }
public static function dimensions ( array $ data ) { if ( empty ( $ data ) ) { return 0 ; } reset ( $ data ) ; $ depth = 1 ; while ( $ elem = array_shift ( $ data ) ) { if ( is_array ( $ elem ) ) { $ depth += 1 ; $ data = & $ elem ; } else { break ; } } return $ depth ; }
Counts the dimensions of an array.
Only considers the dimension of the first element in the array.

If you have an un-even or heterogenous array, consider using Hash::maxDimensions()
to get the dimensions of the array.

@param  array $data Array to count dimensions on
@return int The number of dimensions in $data
@link   http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::dimensions
Counts the dimensions of an array . Only considers the dimension of the first element in the array .