Long story short, client’s hosting is using php 5.2.5 and i desperately need to use the JSON_FORCE_OBJECT option with json_encode() that came with 5.3. Does anyone know some equivalent for that purpose? Point it out please.
Long story short, client’s hosting is using php 5.2.5 and i desperately need to
Share
Casting as an object before encoding worked for me on 5.2.5:
And using PHP 5.3 yields the same output:
You might also try this solution from another thread. Not sure what your exact use-case is.