svn: /phpdoc/en/trunk/reference/json/functions/ json-decode.xml json-last-error.xml
| From: | Richard Quadling | Date: | Wed, 03 Feb 2010 14:08:33 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/json/functions/ json-decode.xml json-last-error.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-5995@lists.php.net to get a copy of this message | ||
rquadling Wed, 03 Feb 2010 14:08:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=294397
Log:
W/S tabs
Changed paths:
U phpdoc/en/trunk/reference/json/functions/json-decode.xml
U phpdoc/en/trunk/reference/json/functions/json-last-error.xml
Modified: phpdoc/en/trunk/reference/json/functions/json-decode.xml
===================================================================
--- phpdoc/en/trunk/reference/json/functions/json-decode.xml 2010-02-03 14:08:11 UTC (rev 294396)
+++ phpdoc/en/trunk/reference/json/functions/json-decode.xml 2010-02-03 14:08:33 UTC (rev 294397)
@@ -148,33 +148,33 @@
<?php
// Encode the data.
$json = json_encode(
- array(
- 1 => array(
- 'English' => array(
- 'One',
- 'January'
- ),
- 'French' => array(
- 'Une',
- 'Janvier'
- )
- )
- )
+ array(
+ 1 => array(
+ 'English' => array(
+ 'One',
+ 'January'
+ ),
+ 'French' => array(
+ 'Une',
+ 'Janvier'
+ )
+ )
+ )
);
// Define the errors.
$json_errors = array(
- JSON_ERROR_NONE => 'No error has occurred',
- JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded',
- JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
- JSON_ERROR_SYNTAX => 'Syntax error',
+ JSON_ERROR_NONE => 'No error has occurred',
+ JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded',
+ JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
+ JSON_ERROR_SYNTAX => 'Syntax error',
);
// Show the errors for different depths.
foreach(range(4, 3, -1) as $depth) {
- var_dump(json_decode($json, True, $depth));
- echo 'Last error : ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL;
- }
+ var_dump(json_decode($json, True, $depth));
+ echo 'Last error : ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL;
+ }
?>
]]>
</programlisting>
Modified: phpdoc/en/trunk/reference/json/functions/json-last-error.xml
===================================================================
--- phpdoc/en/trunk/reference/json/functions/json-last-error.xml 2010-02-03 14:08:11 UTC (rev
294396)
+++ phpdoc/en/trunk/reference/json/functions/json-last-error.xml 2010-02-03 14:08:33 UTC (rev
294397)
@@ -77,26 +77,26 @@
foreach($json as $string)
{
- echo 'Decoding: ' . $string;
- json_decode($string);
+ echo 'Decoding: ' . $string;
+ json_decode($string);
- switch(json_last_error())
- {
- case JSON_ERROR_DEPTH:
- echo ' - Maximum stack depth exceeded';
- break;
- case JSON_ERROR_CTRL_CHAR:
- echo ' - Unexpected control character found';
- break;
- case JSON_ERROR_SYNTAX:
- echo ' - Syntax error, malformed JSON';
- break;
- case JSON_ERROR_NONE:
- echo ' - No errors';
- break;
- }
+ switch(json_last_error())
+ {
+ case JSON_ERROR_DEPTH:
+ echo ' - Maximum stack depth exceeded';
+ break;
+ case JSON_ERROR_CTRL_CHAR:
+ echo ' - Unexpected control character found';
+ break;
+ case JSON_ERROR_SYNTAX:
+ echo ' - Syntax error, malformed JSON';
+ break;
+ case JSON_ERROR_NONE:
+ echo ' - No errors';
+ break;
+ }
- echo PHP_EOL;
+ echo PHP_EOL;
}
?>
]]>