Uri\Rfc3986\Uri::getHost
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.5.0)
Retrieve the normalized host component
Description
Uri\Rfc3986\Uri::getHost(): string|null
Retrieves the normalized host component.
Parameters Parameters
Return Values
Returns the normalized host component as a String if the host component exists, null is returned otherwise.
Examples
Uri\Rfc3986\Uri::getHost basic example
php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com");
echo $uri->getHost();
?>The above example will output:
output
example.comSee Also
Uri\Rfc3986\Uri::getRawHostUri\Rfc3986\Uri::withHostUri\WhatWg\Url::getAsciiHostUri\WhatWg\Url::getUnicodeHost