Home >Backend Development >PHP Tutorial >Detailed explanation of the use of php parse_str() function
php The parse_str() function parses the query string into variables and is mainly used to transfer values (parameters) between pages. This article introduces to coders how to use the php parse_str() function. Interested coders can refer to it. I hope to be helpful.
Definition and usage
parse_str() function parses the query string into variables.
Note: If the array parameter is not set, the variables set by this function will overwrite the existing variables with the same name.
Note: The magic_quotes_gpc setting in the php.ini file affects the output of this function. If enabled, variables are converted by addslashes() before being parsed by parse_str() .
Syntax
parse_str(string,array)
Parameters | Description |
---|---|
string | Required. Specifies the string to parse. |
array | Optional. Specifies the name of the array in which the variable is stored. This parameter indicates that the variable will be stored in an array. |
Technical details
Return value: | No return value. |
PHP Version: | 4+ |
Change Log: | In PHP 4.0.3 , added the array parameter. |
Example
Storing variables in an array:
<?php parse_str("name=Bill&age=60",$myArray); print_r($myArray); ?>
Related recommendations:
php outputs formatted string function printf()
Encryption in php Sharing examples of using the decryption string function
The above is the detailed content of Detailed explanation of the use of php parse_str() function. For more information, please follow other related articles on the PHP Chinese website!