Re: Inconsistent json_decode() results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/5/5 François Beausoleil <francois@xxxxxxxxxxx>

> Hello all!
>
> We're seeing inconsistent json decoding between PHP versions:
> http://gist.github.com/390090
>
> Calling json_decode() from 5.2.6 returns an associative array when asked,
> while 5.2.10 always returns a stdClass.  Is this a bug or a problem with my
> calling convention?
>
> Thanks!
> François


By the way, if you're stuck on 5.2.10, you could simply cast the result to
array:

var_dump((array)json_decode('{"_urls": ["a", "b"]}'));

Michiel

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux