Uri\WhatWg\Url::equals
Check if two URLs are equivalent
説明
public bool Uri\WhatWg\Url::equals(Uri\WhatWg\Url $url, Uri\UriComparisonMode $comparisonMode = Uri\UriComparisonMode::ExcludeFragment)
Checks if two URLs are equivalent.
パラメータ
-
url
-
URL to compare the current URL 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 URLs are equivalent, or false otherwise.
例
例1 Uri\WhatWg\Url::equals basic example
<?php
$url1 = new \Uri\WhatWg\Url("https://example.com");
$url2 = new \Uri\WhatWg\Url("HTTPS://example.com");
var_dump($url1->equals($url2));
?>