> -----Original Message----- > From: mike [mailto:mike...@gmail.com] > Sent: 15 December 2008 18:10 > To: Rasmus Lerdorf > Cc: PHP Developers Mailing List > Subject: Re: [PHP-DEV] json_encode() > > On Mon, Dec 15, 2008 at 9:50 AM, Rasmus Lerdorf > <ras...@lerdorf.com> wrote: > > > 1. Document the fact that if you want to strictly conform > to the JSON > > spec and be sure your json_encode output will work in various JSON > > parsers, you have to pass it a PHP array or object. > > Instead of json_encode(34) the suggestion would be > json_encode(array(34)) ? Seems kind of like a lame thing to require. > IMHO the language should "do the right thing" as far as the > consumer (javascript/JSON parser) is concerned. However, > Douglas is infinitely more educated than I am here. This is > just my $0.02 as a PHP user.
Don't think that's what he said... More like... assert(is_object($foo) || is_array($foo)); // ensure strictly conforming $json = json_encode($foo); Jared -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php