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

Uri\WhatWg\Url::getAsciiHost

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the host component as an ASCII String

Description

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

Retrieves the host component as a String using punycode transcription instead of Unicode characters.

Parameters Parameters

Return Values

Returns the host component as an ASCII String if the host component exists, null is returned otherwise.

Examples

Uri\WhatWg\Url::getAsciiHost basic example

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

echo $url->getAsciiHost();
?>

The above example will output:

output
example.com

See Also

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

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