|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-30 05:57 UTC] xiezhenye at gmail dot com
Description:
------------
json_encode return unexpected result on uncontinues array.
Reproduce code:
---------------
$a = array(1,2,3);
echo json_encode($a),"\n";
unset($a[1]);
echo json_encode($a),"\n";
Expected result:
----------------
[1,2,3]
[1,3]
Actual result:
--------------
[1,2,3]
{"0":1,"2":3}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
var_dump($a); Show: array(2) { [0]=> int(1) [2]=> int(3) } Hence, it isn't a bug.