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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gater89 at web dot de
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC