Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP parse_str() Function

PHP parse_str() Function

PHP String Reference Manual PHP String Reference Manual

Example

Parse a query string into variables:

"; echo $age; ?>

Run Example »


Definition and Usage

The parse_str() function parses a query string into variables.

Note:

If the array parameter is not set, the variables set by this function will overwrite 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 parse_str() parses them.


Syntax

parse_str(

string,array

)

Parameters Description
string Required. Specifies the string to parse.
array Optional. Specifies the name of the array to store the variables. This parameter indicates that variables are stored in an array.

Technical Details

Return Value: No value is returned.
PHP Version: 4+
Changelog: In PHP 4.0.3, the array parameter was added.

More examples

Example 1

Store variables into an array:

Run Example »


PHP String Reference Manual PHP String Reference Manual