update page now

Uri\Rfc3986\Uri::equals

(PHP 8 >= 8.5.0)

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

Descrizione

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

Checks if two URIs are equivalent.

Elenco dei parametri

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.

Valori restituiti

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

Esempi

Example #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));
?>

Il precedente esempio visualizzerà:

bool(true)

Vedere anche:

add a note

User Contributed Notes

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