Re: Patch and test cases too for

From: Date: Tue, 17 Mar 2009 23:20:34 +0000
Subject: Re: Patch and test cases too for
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-43383@lists.php.net to get a copy of this message
On 11 Mar 2009, at 19:25, Christopher Östlund wrote:
I think this behavior is a bit odd too: php -r "echo json_encode(array(0=>'test'));" // ["test"] php -r "echo json_encode(array(1=>'test'));" // {"1":"test"}
The reason for this is encoding looks to see if the array is sequentially numbered from 0 to x, and if so its a compatible javascript array. If it starts at any other value or skips a number then it creates an object for its output. Scott

« previous php.internals (#43383) next »