php man page for parse_str

Query: parse_str

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

PARSE_STR(3)								 1							      PARSE_STR(3)

parse_str - Parses the string into variables

SYNOPSIS
void parse_str (string $str, [array &$arr])
DESCRIPTION
Parses $str as if it were the query string passed via a URL and sets variables in the current scope. Note To get the current QUERY_STRING, you may use the variable $_SERVER['QUERY_STRING']. Also, you may want to read the section on vari- ables from external sources. Note The magic_quotes_gpc setting affects the output of this function, as parse_str(3) uses the same mechanism that PHP uses to populate the $_GET, $_POST, etc. variables.
PARAMETERS
o $str - The input string. o $arr - If the second parameter $arr is present, variables are stored in this variable as array elements instead.
RETURN VALUES
No value is returned.
EXAMPLES
Example #1 Using parse_str(3) <?php $str = "first=value&arr[]=foo+bar&arr[]=baz"; parse_str($str); echo $first; // value echo $arr[0]; // foo bar echo $arr[1]; // baz parse_str($str, $output); echo $output['first']; // value echo $output['arr'][0]; // foo bar echo $output['arr'][1]; // baz ?>
SEE ALSO
parse_url(3), pathinfo(3), http_build_query(3), get_magic_quotes_gpc(3), urldecode(3). PHP Documentation Group PARSE_STR(3)
Related Man Pages
collator_sort_with_sort_keys(3) - php
get_defined_vars(3) - php
json_encode(3) - php
collator_sort(3) - php
locale_get_all_variants(3) - php
Similar Topics in the Unix Linux Community
Passing output of sed/echo to a variable
Storing the output into a variable
math in unix
Breaking a string into four different numbers
Integer array length