php8.5
Home/ Manual/ rfc3986 / uri/ Uri\Rfc3986\Uri::getFragment

Uri\Rfc3986\Uri::getFragment

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the normalized fragment component

Description

Uri\Rfc3986\Uri::getFragment(): string|null

Retrieves the normalized fragment component.

Parameters Parameters

Return Values

Returns the normalized fragment component as a String if the fragment component exists, null is returned otherwise.

Examples

Uri\Rfc3986\Uri::getFragment basic example

php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com#foo=bar");

echo $uri->getFragment();
?>

The above example will output:

output
foo=bar

See Also

  • Uri\Rfc3986\Uri::getRawFragment
  • Uri\Rfc3986\Uri::withFragment
  • Uri\WhatWg\Url::getFragment

Source: reference/uri/uri/rfc3986/uri/getfragment.xml · from the official PHP manual (php/doc-en)