public static function path($array, $path, &$found, $delimiter = '.')
    {
        if (!is_array($array)) {
            return false;
        }

        if (is_array($path)) {
            $keys = $path;
        } else {
            if (array_key_exists($path, $array)) {
                $found = $array[$path]; // No need to do extra processing
                return true;
            }

            $keys = explode($delimiter, trim($path, "{$delimiter} "));
        }

        do {
            $key = array_shift($keys);

            if (ctype_digit($key)) {
                $key = (int)$key;
            }

            if (isset($array[$key])) {
                if ($keys) {
                    if (is_array($array[$key])) {
                        $array = $array[$key];
                    } else {
                        break;
                    }
                } else {
                    $found = $array[$key];
                    return true;
                }
            } else {
                break;
            }
        } while ($keys);

        // Unable to find the value requested
        return false;
    }
public static function path($array, $path, &$found, $delimiter = '.')
    {
        if (!is_array($array)) {
            return false;
        }

        if (is_array($path)) {
            $keys = $path;
        } else {
            if (array_key_exists($path, $array)) {
                $found = $array[$path]; // No need to do extra processing
                return true;
            }

            $keys = explode($delimiter, trim($path, "{$delimiter} "));
        }

        do {
            $key = array_shift($keys);

            if (ctype_digit($key)) {
                $key = (int)$key;
            }

            if (isset($array[$key])) {
                if ($keys) {
                    if (is_array($array[$key])) {
                        $array = $array[$key];
                    } else {
                        break;
                    }
                } else {
                    $found = $array[$key];
                    return true;
                }
            } else {
                break;
            }
        } while ($keys);

        // Unable to find the value requested
        return false;
    }
public static function path ( $ array , $ path , & $ found , $ delimiter = '.' ) { if ( ! is_array ( $ array ) ) { return false ; } if ( is_array ( $ path ) ) { $ keys = $ path ; } else { if ( array_key_exists ( $ path , $ array ) ) { $ found = $ array [ $ path ] ; // No need to do extra processing return true ; } $ keys = explode ( $ delimiter , trim ( $ path , "{$delimiter} " ) ) ; } do { $ key = array_shift ( $ keys ) ; if ( ctype_digit ( $ key ) ) { $ key = ( int ) $ key ; } if ( isset ( $ array [ $ key ] ) ) { if ( $ keys ) { if ( is_array ( $ array [ $ key ] ) ) { $ array = $ array [ $ key ] ; } else { break ; } } else { $ found = $ array [ $ key ] ; return true ; } } else { break ; } } while ( $ keys ) ; // Unable to find the value requested return false ; }
Gets a value from an array using a dot separated path.
Returns true if found and false if not.

@param  array  $array     array to search
@param  mixed  $path      key path string (delimiter separated) or array of keys
@param  mixed  $found     value that was found
@param  string $delimiter key path delimiter
@return bool
Gets a value from an array using a dot separated path . Returns true if found and false if not .