mb_parse_str()
mb_parse_str() — Parse GET/POST/COOKIE data and set global variable.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only be used for GET data for now. It parses URL encoded data, detects encoding, converts coding to internal encoding and set values to the result array or global variables.
Signature
mb_parse_str(string $string, array &$result): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string | string | The URL encoded data. |
| &$result | array | An array containing decoded and character encoded converted values. |
Return value
Returns true on success or false on failure.
Example
The PHP manual ships no example for mb_parse_str(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.0.0 | The second parameter was no longer optional. |
| 7.2.0 | Calling mb_parse_str() without the second parameter was deprecated. |
See also
mb_detect_order(), mb_internal_encoding()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page mb_parse_str() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.