public static function getValueByPath(array &$array, $path)
    {
        if (is_string($path)) {
            $path = explode('.', $path);
        } elseif (!is_array($path)) {
            throw new \InvalidArgumentException('getValueByPath() expects $path to be string or array, "' . gettype($path) . '" given.', 1304950007);
        }
        $key = array_shift($path);
        if (isset($array[$key])) {
            if (count($path) > 0) {
                return (is_array($array[$key])) ? self::getValueByPath($array[$key], $path) : null;
            } else {
                return $array[$key];
            }
        } else {
            return null;
        }
    }
public static function getValueByPath(array &$array, $path)
    {
        if (is_string($path)) {
            $path = explode('.', $path);
        } elseif (!is_array($path)) {
            throw new \InvalidArgumentException('getValueByPath() expects $path to be string or array, "' . gettype($path) . '" given.', 1304950007);
        }
        $key = array_shift($path);
        if (isset($array[$key])) {
            if (count($path) > 0) {
                return (is_array($array[$key])) ? self::getValueByPath($array[$key], $path) : null;
            } else {
                return $array[$key];
            }
        } else {
            return null;
        }
    }
public static function getValueByPath ( array & $ array , $ path ) { if ( is_string ( $ path ) ) { $ path = explode ( '.' , $ path ) ; } elseif ( ! is_array ( $ path ) ) { throw new \ InvalidArgumentException ( 'getValueByPath() expects $path to be string or array, "' . gettype ( $ path ) . '" given.' , 1304950007 ) ; } $ key = array_shift ( $ path ) ; if ( isset ( $ array [ $ key ] ) ) { if ( count ( $ path ) > 0 ) { return ( is_array ( $ array [ $ key ] ) ) ? self :: getValueByPath ( $ array [ $ key ] , $ path ) : null ; } else { return $ array [ $ key ] ; } } else { return null ; } }
Returns the value of a nested array by following the specifed path.

@param array &$array The array to traverse as a reference
@param array|string $path The path to follow. Either a simple array of keys or a string in the format 'foo.bar.baz'
@return mixed The value found, NULL if the path didn't exist (note there is no way to distinguish between a found NULL value and "path not found")
@throws \InvalidArgumentException
Returns the value of a nested array by following the specifed path .