This article mainly introduces the definition and usage examples of the php parse_str() function. Interested friends can refer to it. I hope it will be helpful to everyone.
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.
Definition and usage
The 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 array parameter. |
Example
Storing variables in an array:
<?php parse_str("name=Bill&age=60",$myArray); print_r($myArray); ?>
Summary: Above That’s the entire content of this article, I hope it will be helpful to everyone’s study.
Related recommendations:
PHP implementation of user login case code
Analysis of PHP paging display method (with PHP general paging class)
PHP uses the PDO abstraction layer to obtain query results
The above is the detailed content of Detailed explanation of the definition and usage examples of php parse_str() function. For more information, please follow other related articles on the PHP Chinese website!