public static function get($data, string $path, $default = null)
    {
        Assert::isArrayAccessible($data);
        Assert::stringNotEmpty($path);

        $path = explode('/', $path);

        while (($part = array_shift($path)) !== null) {
            if ((! is_array($data) && ! ($data instanceof ArrayAccess)) || ! isset($data[$part])) {
                return $default;
            }
            $data = $data[$part];
        }

        return $data;
    }
public static function get($data, string $path, $default = null)
    {
        Assert::isArrayAccessible($data);
        Assert::stringNotEmpty($path);

        $path = explode('/', $path);

        while (($part = array_shift($path)) !== null) {
            if ((! is_array($data) && ! ($data instanceof ArrayAccess)) || ! isset($data[$part])) {
                return $default;
            }
            $data = $data[$part];
        }

        return $data;
    }
public static function get ( $ data , string $ path , $ default = null ) { Assert :: isArrayAccessible ( $ data ) ; Assert :: stringNotEmpty ( $ path ) ; $ path = explode ( '/' , $ path ) ; while ( ( $ part = array_shift ( $ path ) ) !== null ) { if ( ( ! is_array ( $ data ) && ! ( $ data instanceof ArrayAccess ) ) || ! isset ( $ data [ $ part ] ) ) { return $ default ; } $ data = $ data [ $ part ] ; } return $ data ; }
Gets a value from an array or `ArrayAccess` object using path syntax to retrieve nested data.

Example:

// Get the bar key of a set of nested arrays.
// This is equivalent to $data['foo']['baz']['bar'] but won't
// throw warnings for missing keys.
Arr::get($data, 'foo/baz/bar');

This method does not allow for keys that contain `/`.

This code is adapted from Michael Dowling in his Guzzle library.

@param array|ArrayAccess $data    Data to retrieve values from
@param string            $path    Path to traverse and retrieve a value from
@param mixed|null        $default Default value to return if key does not exist

@return mixed|null
Gets a value from an array or ArrayAccess object using path syntax to retrieve nested data .