Uri\Rfc3986\Uri::getPort
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.5.0)
Retrieve the normalized port component
Description
Uri\Rfc3986\Uri::getPort(): int|null
Retrieves the normalized port component.
Parameters Parameters
Return Values
Returns the normalized port component as an Integer if the port component exists, null is returned otherwise.
Examples
Uri\Rfc3986\Uri::getPort basic example
php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com:443");
echo $uri->getPort();
?>The above example will output:
output
443See Also
Uri\Rfc3986\Uri::withPortUri\WhatWg\Url::getPort