update page now

Uri\Rfc3986\Uri::equals

(PHP 8 >= 8.5.0)

Uri\Rfc3986\Uri::equalsCheck if two URIs are equivalent

Beschreibung

public Uri\Rfc3986\Uri::equals(Uri\Rfc3986\Uri $uri, Uri\UriComparisonMode $comparisonMode = Uri\UriComparisonMode::ExcludeFragment): bool

Checks if two URIs are equivalent.

Parameter-Liste

uri
URI to compare the current URI against.
comparisonMode
Whether the fragment component is taken into account of the comparison (Uri\UriComparisonMode::IncludeFragment) or not (Uri\UriComparisonMode::ExcludeFragment). By default, the fragment is excluded.

Rückgabewerte

Returns true if the two URIs are equivalent, or false otherwise.

Beispiele

Beispiel #1 Uri\Rfc3986\Uri::equals() basic example

<?php
$uri1
= new \Uri\Rfc3986\Uri("https://example.com");
$uri2 = new \Uri\Rfc3986\Uri("HTTPS://example.com");

var_dump($uri1->equals($uri2));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(true)

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top