URL::offsetExists()

Checks if URL data exists.

Table of Contents
  1. Description
  2. Example

Description

URL::offsetExists(mixed $key): bool;

This method is a requirement to be able to implement the ArrayAccess interface and aims to make the object data accessible using array access syntax. You won’t use this method directly, it will be executed automatically when you try to check the URL data with array access syntax. This method checks if an URL data exists and will only work when checked using empty() or isset() language construct.

Example

$url = new URL('http://127.0.0.1/foo/bar/baz');

$url->hash = 'foo';

test(empty($url['path'])); // Returns `false`
test(empty($url['query'])); // Returns `true`
test(isset($url['hash'])); // Returns `true`

URL::current()

Returns the full URL address along with its query and hash.

URL::offsetExists()

Checks if URL data exists.