parse_str

FunctionParams and return types changed in PHP 8.0

Parse a string as a URL query string.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

parse_str Function synopsis

parse_str(string $string, &$result): void

Parameters

$string

Typestring

The input string.

$result

Passed by reference

A variable passed by reference, which will be set to an array containing the key-value pairs extracted from $string. If the $result parameter is not passed, a separate variable is set in the local scope for each key.

Note that the parameter $result is passed by reference, and contains additional/updated context data that may be useful.

Return value

The parse_str function is a void function; it does not return any values.

Changes to the parse_str Function

PHP 8.0

  • Return type added: void
  • Parameter name of parameter #1 changed: $encoded_string to $string
  • Parameter type added for parameter #1 ($string): string
- parse_str($encoded_string, &$result)
+ parse_str(string $string, &$result): void

parse_str Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes