php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64866 Example is incorrect
Submitted: 2013-05-17 09:01 UTC Modified: 2013-05-17 20:18 UTC
From: gater89 at web dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-05-17 09:01 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-17 20:18 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2013-05-17 20:18 UTC] aharvey@php.net
The example's correct: JSON uses curly braces for objects (PHP associative arrays). Test case: http://3v4l.org/pMBmv
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 16 02:01:23 2021 UTC