Uri\Rfc3986\Uri::equals
Check if two URIs are equivalent
説明
public bool Uri\Rfc3986\Uri::equals(Uri\Rfc3986\Uri $uri, Uri\UriComparisonMode $comparisonMode = Uri\UriComparisonMode::ExcludeFragment)
Checks if two URIs are equivalent.
パラメータ
-
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.
戻り値
Returns true if the two URIs are equivalent, or false otherwise.
例
例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));
?>