public static function get(array $array, $keyPath)
    {
        self::checkKeyPathIsValidAndNonEmpty($keyPath);
        $keys = self::explodeKeys(strval($keyPath));

        $nextValue = null;
        while ($keys !== array()) {
            $key = array_shift($keys);

            if (!array_key_exists($key, $array)) {
                throw new KeyNotFound($keyPath);
            }
            $nextValue = $array[$key];
            if (!is_array($nextValue)) {
                break;
            }
            $array = $nextValue;
        }

        if ($keys === array()) {
            return $nextValue;
        }

        throw new KeyNotFound($keyPath);
    }
public static function get(array $array, $keyPath)
    {
        self::checkKeyPathIsValidAndNonEmpty($keyPath);
        $keys = self::explodeKeys(strval($keyPath));

        $nextValue = null;
        while ($keys !== array()) {
            $key = array_shift($keys);

            if (!array_key_exists($key, $array)) {
                throw new KeyNotFound($keyPath);
            }
            $nextValue = $array[$key];
            if (!is_array($nextValue)) {
                break;
            }
            $array = $nextValue;
        }

        if ($keys === array()) {
            return $nextValue;
        }

        throw new KeyNotFound($keyPath);
    }
public static function get ( array $ array , $ keyPath ) { self :: checkKeyPathIsValidAndNonEmpty ( $ keyPath ) ; $ keys = self :: explodeKeys ( strval ( $ keyPath ) ) ; $ nextValue = null ; while ( $ keys !== array ( ) ) { $ key = array_shift ( $ keys ) ; if ( ! array_key_exists ( $ key , $ array ) ) { throw new KeyNotFound ( $ keyPath ) ; } $ nextValue = $ array [ $ key ] ; if ( ! is_array ( $ nextValue ) ) { break ; } $ array = $ nextValue ; } if ( $ keys === array ( ) ) { return $ nextValue ; } throw new KeyNotFound ( $ keyPath ) ; }
Get the dotted key path value from the array.

@param array $array
@param string $keyPath

@return mixed The returned value, or the default value if no value is found.
@throws KeyNotFound
@throws BadKeyPath
Get the dotted key path value from the array .