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

Uri\Rfc3986\Uri::getQuery

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the normalized query component

Description

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

Retrieves the normalized query component.

Parameters Parameters

Return Values

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

Examples

Uri\Rfc3986\Uri::getQuery basic example

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

echo $uri->getQuery();
?>

The above example will output:

output
foo=bar

See Also

  • Uri\Rfc3986\Uri::getRawQuery
  • Uri\Rfc3986\Uri::withQuery
  • Uri\WhatWg\Url::getQuery

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