Document new parameter to json_decode()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@299623 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sara Golemon 2010-05-22 11:32:54 +00:00
parent daf137f592
commit a675b6d76f

View file

@ -13,6 +13,7 @@
<methodparam><type>string</type><parameter>json</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>assoc</parameter><initializer>false</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>depth</parameter><initializer>512</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
Takes a JSON encoded string and converts it into a PHP variable.
@ -48,6 +49,16 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Bitmask of JSON decode options. Currently only
<constant>JSON_BIGINT_AS_STRING</constant>
is supported (default is to cast large integers as floats)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
@ -64,6 +75,30 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.4.0</entry>
<entry>
The <parameter>options</parameter> parameter was added.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
@ -204,6 +239,27 @@ Last error : No error has occurred
NULL
Last error : The maximum stack depth has been exceeded
]]>
</screen>
</example>
<example>
<title><function>json_decode</function> of large integers</title>
<programlisting role="php">
<![CDATA[
<?php
$json = '12345678901234567890';
var_dump(json_decode($json));
var_dump(json_decode($json, false, 512, JSON_BIGINT_AS_STRING));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
float(1.2345678901235E+19)
string(20) "12345678901234567890"
]]>
</screen>
</example>