Uri\Rfc3986\Uri::equals
(PHP 8 >= 8.5.0)
Check if two URIs are equivalent
Description
Checks if two URIs are equivalent.
Parameters
uriURI to compare the current URI against.
comparisonModeWhether the fragment component is taken into account of the comparison (
Uri\UriComparisonMode::IncludeFragment) or not (Uri\UriComparisonMode::ExcludeFragment). By default, the fragment is excluded.
Return Values
Returns true if the two URIs are equivalent, or false otherwise.
Examples
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));
?>The above example will output:
bool(true)See Also
Uri\WhatWg\Url::equals