mb_parse_str
Parse GET/POST/COOKIE data and set global variables
Function name: mb_parse_str()
Function: parse query string and break it into variables
Applicable version: PHP 4 >= 4.0.6, PHP 5, PHP 7
Usage: mb_parse_str(string $encoded_string, array &$result): bool
parameter:
Return value:
Example:
$queryString = "name=John&age=30&city=New York"; // 创建一个空数组来存储解析结果$result = array(); // 解析查询字符串mb_parse_str($queryString, $result); // 打印解析后的结果print_r($result);
Output:
Array ( [name] => John [age] => 30 [city] => New York )
Explanation: The mb_parse_str() function parses the query string into a variable and stores it in an array. In the example, we pass a query string to the function and then print the parsed result using the print_r() function. As you can see, the result is an associative array, where the key is the parameter name in the query string and the value is the value of the parameter.