philip Thu Oct 17 20:20:32 2002 EDT Modified files: /phpdoc/en/reference/strings/functions parse-str.xml Log: Added note about QUERY_STRING; See also parse_url() and pathinfo(). Added/modified example to include use of the second arr parameter. Index: phpdoc/en/reference/strings/functions/parse-str.xml diff -u phpdoc/en/reference/strings/functions/parse-str.xml:1.2 phpdoc/en/reference/strings/functions/parse-str.xml:1.3 --- phpdoc/en/reference/strings/functions/parse-str.xml:1.2 Wed Apr 17 02:44:21 2002 +++ phpdoc/en/reference/strings/functions/parse-str.xml Thu Oct 17 20:20:32 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> <refentry id="function.parse-str"> <refnamediv> @@ -25,23 +25,39 @@ Support for the optional second parameter was added in PHP 4.0.3. </para> </note> + <note> + <para> + To get the current <emphasis>QUERY_STRING</emphasis>, you may use the variable + <link linkend="reserved.variables.server">$_SERVER['QUERY_STRING']</link>. + Also, you may want to read the section on + <link linkend="language.variables.external">variables from outside of +PHP</link>. + </para> + </note> <para> <example> <title>Using <function>parse_str</function></title> <programlisting role="php"> <![CDATA[ -$str = "first=value&second[]=this+works&second[]=another"; +<?php +$str = "first=value&arr[]=foo+bar&arr[]=baz"; parse_str($str); -echo $first; /* prints "value" */ -echo $second[0]; /* prints "this works" */ -echo $second[1]; /* prints "another" */ +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 + +?> ]]> </programlisting> </example> </para> <para> - See also <function>set_magic_quotes_runtime</function> - and <function>urldecode</function>. + See also <function>parse_url</function>, <function>pathinfo</function>, + <function>set_magic_quotes_runtime</function>, and +<function>urldecode</function>. </para> </refsect1> </refentry>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php