The PHP parse_str () function parses the query string into a variable, mainly for passing values (parameters) between pages. This article to the Code Agriculture introduced PHP parse_str () function use method, interested in the code farmers can refer to.
Definitions and usage
The Parse_str () function parses the query string into a variable.
Note: If the array parameter is not set, the variable set by the function overrides the existing variable with the same name.
Note: The MAGIC_QUOTES_GPC setting in the php.ini file affects the output of the function. If enabled, the variable is converted by addslashes () before Parse_str () is parsed.
Grammar
Parameters |
Description |
String |
Necessary. Specify the string to parse. |
Array |
Optional. Specify the name of the array where the variable is stored. This parameter indicates that the variable will be stored in the array. |
Technical details
return value: |
no return value. |
PHP version: |
4 + |
Update log: |
In the PHP 4.0.3, the array parameter is added. |
Instance
To store variables in an array:
<?php
parse_str ("name=bill&age=60", $myArray);
Print_r ($myArray);
? >
The above PHP parse_str () function definition and usage is small series to share all the content, hope to give everyone a reference, also hope that we support cloud habitat community.