public static function targetGet($needle, array $haystack, $default = null)
    {
        if ($needle === null) {
            return $haystack;
        }

        $parts  = preg_split('/(?<!\\\\)\./', $needle);

        foreach ($parts as $part) {
            $key = str_replace('\\.', '.', $part);

            if (
                is_array($haystack) === false ||
                array_key_exists($key, $haystack) === false
            ) {
                return $default;
            }

            $haystack = $haystack[$part];
        }

        return $haystack;
    }
public static function targetGet($needle, array $haystack, $default = null)
    {
        if ($needle === null) {
            return $haystack;
        }

        $parts  = preg_split('/(?<!\\\\)\./', $needle);

        foreach ($parts as $part) {
            $key = str_replace('\\.', '.', $part);

            if (
                is_array($haystack) === false ||
                array_key_exists($key, $haystack) === false
            ) {
                return $default;
            }

            $haystack = $haystack[$part];
        }

        return $haystack;
    }
public static function targetGet ( $ needle , array $ haystack , $ default = null ) { if ( $ needle === null ) { return $ haystack ; } $ parts = preg_split ( '/(?<!\\\\)\./' , $ needle ) ; foreach ( $ parts as $ part ) { $ key = str_replace ( '\\.' , '.' , $ part ) ; if ( is_array ( $ haystack ) === false || array_key_exists ( $ key , $ haystack ) === false ) { return $ default ; } $ haystack = $ haystack [ $ part ] ; } return $ haystack ; }
Get an value from an array via a dotted notation

@param  string $needle       (my.scope.notation) Use \. to escape . characters
@param  array  $haystack
@param  mixed  $default

@return mixed
Get an value from an array via a dotted notation