Skip to content

Uri: withFragment Example

Terry L edited this page Jun 20, 2020 · 3 revisions
Clone this wiki locally

Shieldon\Psr7\Uri

withFragment($fragment)

Return an instance with the specified URI fragment.

  • param string fragment * The fragment to use with the new instance.
  • return static

Example:

echo $uri->getFragment();
// Outputs: yes-i-do

$uri = $uri->withFragment('no-i-cant');
echo $uri->getFragment();
// Outputs: no-i-cant