Check if two URLs are equivalent

# Uri\WhatWg\Url::equals

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::equals — Check if two URLs are equivalent

### 说明

public function Uri\WhatWg\Url::equals(Uri\WhatWg\Url `$url`, Uri\UriComparisonMode `$comparisonMode` = `Uri\UriComparisonMode::ExcludeFragment`): bool

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

以上示例会输出：

    bool(true)

### 参见

- Uri\Rfc3986\Uri::equals() - Check if two URIs are equivalent

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open