svn: /phpdoc/en/trunk/reference/json/functions/ json-decode.xml

From: Date: Tue, 11 Dec 2012 10:30:48 +0000
Subject: svn: /phpdoc/en/trunk/reference/json/functions/ json-decode.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-10851@lists.php.net to get a copy of this message
googleguy Tue, 11 Dec 2012 10:30:48 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=328740 Log: Fixed json_decode large integer example with use of JSON_BIGINT_AS_STRING as it was demonstrated wrong use of the function's option. I modified the example to reflect the difference in behavior when you're using an object with an integer property that is too large to fit as type int in PHP instead of using a string, since strings are always just decoded as strings in PHP. Changed paths: U phpdoc/en/trunk/reference/json/functions/json-decode.xml Modified: phpdoc/en/trunk/reference/json/functions/json-decode.xml =================================================================== --- phpdoc/en/trunk/reference/json/functions/json-decode.xml 2012-12-11 08:32:27 UTC (rev 328739) +++ phpdoc/en/trunk/reference/json/functions/json-decode.xml 2012-12-11 10:30:48 UTC (rev 328740) @@ -232,7 +232,7 @@ <programlisting role="php"> <![CDATA[ <?php -$json = '12345678901234567890'; +$json = '{"number": 12345678901234567890}'; var_dump(json_decode($json)); var_dump(json_decode($json, false, 512, JSON_BIGINT_AS_STRING)); @@ -243,8 +243,14 @@ &example.outputs; <screen> <![CDATA[ -float(1.2345678901235E+19) -string(20) "12345678901234567890" +object(stdClass)#1 (1) { + ["number"]=> + float(1.2345678901235E+19) +} +object(stdClass)#1 (1) { + ["number"]=> + string(20) "12345678901234567890" +} ]]> </screen> </example>

« previous php.doc.cvs (#10851) next »