Doc #64866 [Opn->Nab]: Example is incorrect
| From: | aharvey@php.net | Date: | Fri, 17 May 2013 20:18:31 +0000 |
| Subject: | Doc #64866 [Opn->Nab]: Example is incorrect | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9844@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64866&edit=1
ID: 64866
Updated by: aharvey@php.net
Reported by: gater89 at web dot de
Summary: Example is incorrect
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The example's correct: JSON uses curly braces for objects (PHP associative arrays). Test case:
http://3v4l.org/pMBmv
Previous Comments:
------------------------------------------------------------------------
[2013-05-17 09:01:06] gater89 at web dot de
Description:
------------
---
From manual page: http://www.php.net/function.json-encode#refsect1-function.json-encode-examples
---
Test script:
---------------
<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd'
=> 4, 'e' => 5);
echo json_encode($arr);
?>
Output:
{"a":1,"b":2,"c":3,"d":4,"e":5}
is wrong
["a":1,"b":2,"c":3,"d":4,"e":5]
this is correct
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64866&edit=1