php8.5
Home/ Manual/ whatwg / url/ Uri\WhatWg\Url::getUnicodeHost

Uri\WhatWg\Url::getUnicodeHost

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the host component as an Unicode String

Description

Uri\WhatWg\Url::getUnicodeHost(): string|null

Retrieves the host component as a String, which may contain Unicode characters.

Parameters Parameters

Return Values

Returns the host component as a Unicode String if the host component exists, null is returned otherwise.

Examples

Uri\WhatWg\Url::getUnicodeHost basic example

php
<?php
$url = new \Uri\WhatWg\Url("https://example.com");

echo $url->getUnicodeHost();
?>

The above example will output:

output
example.com

See Also

  • Uri\WhatWg\Url::getAsciiHost
  • Uri\WhatWg\Url::withHost
  • Uri\Rfc3986\Uri::getRawHost
  • Uri\Rfc3986\Uri::getHost

Source: reference/uri/uri/whatwg/url/getunicodehost.xml · from the official PHP manual (php/doc-en)