Detailed explanation of the use of php parse_str() function

*文
Release: 2023-03-18 19:50:01
Original
2318 people have browsed it

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)
Copy after login
ParametersDescription
stringRequired. 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); 
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!