Doc #64866 [NEW]: Example is incorrect

From: Date: Fri, 17 May 2013 09:01:06 +0000
Subject: Doc #64866 [NEW]: Example is incorrect
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9841@lists.php.net to get a copy of this message
From:             gater89 at web dot de
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Example is incorrect

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 bug report at https://bugs.php.net/bug.php?id=64866&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=64866&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=64866&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=64866&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64866&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64866&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64866&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64866&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64866&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64866&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64866&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=64866&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=64866&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64866&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64866&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64866&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64866&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64866&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64866&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64866&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64866&r=mysqlcfg



Thread (2 messages)

« previous php.doc.bugs (#9841) next »