PHP » Strings » parse_str()

Syntax:
void parse_str(string query [, array vars])
query
URL to parse.
vars
Array to return the variables in.

Parses URLs.

The parse_str() function parses query strings from URLs as they appear in HTTP GET requests. The embedded variables are made available to the script. If the optional vars parameter is specified, the variables from the query string will be returned in it, in addition to being directly accessible to the script.

Examples

Code:
<?php

$url = "var1=hello&var2=world";

parse_str($url);
print "$var1 $var2";

?>
Output:
hello world
Explanation:

parse_str() is used to parse a query string.

See Also: