Detailed explanation of the definition and usage examples of php parse_str() function

墨辰丷
Release: 2023-03-29 12:54:02
Original
1509 people have browsed it

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)
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 array parameter.

Example

Storing variables in an array:

<?php 
parse_str("name=Bill&age=60",$myArray); 
print_r($myArray); 
?>
Copy after login

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!

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!