php-doc-en/reference/strings/functions/parse-str.xml

69 lines
2 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.parse-str">
<refnamediv>
<refname>parse_str</refname>
<refpurpose>Parses the string into variables</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>parse_str</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>arr
</parameter></methodparam>
</methodsynopsis>
<para>
Parses <parameter>str</parameter> as if it were the query string
passed via an URL and sets variables in the current scope. If
the second parameter <parameter>arr</parameter> is present,
variables are stored in this variable as an array elements instead.
</para>
<note>
<para>
Support for the optional second parameter was added in PHP 4.0.3.
</para>
</note>
<para>
<example>
<title>Using <function>parse_str</function></title>
<programlisting role="php">
<![CDATA[
$str = "first=value&second[]=this+works&second[]=another";
parse_str($str);
echo $first; /* prints "value" */
echo $second[0]; /* prints "this works" */
echo $second[1]; /* prints "another" */
]]>
</programlisting>
</example>
</para>
<para>
See also <function>set_magic_quotes_runtime</function>
and <function>urldecode</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->