Uri\WhatWg\Url::getFragment
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.5.0)
Retrieve the fragment component
Description
Uri\WhatWg\Url::getFragment(): string|null
Retrieves the fragment component.
Parameters Parameters
Return Values
Returns the fragment component as a String if the fragment component exists, null is returned otherwise.
Examples
Uri\WhatWg\Url::getFragment basic example
php
<?php
$url = new \Uri\WhatWg\Url("https://example.com#foo");
echo $url->getFragment();
?>The above example will output:
output
fooSee Also
Uri\WhatWg\Url::withFragmentUri\Rfc3986\Uri::getRawFragmentUri\Rfc3986\Uri::getFragment