PHP objects vs. arrays
Whenever I have to talk between PHP and JavaScript, and especially when it comes to JSON, I have to decide whether I am going to use arrays or objects. JavaScript plays well with both, but PHP doesn’t. json_decode outputs a steaming pile of stdClass instances which lack the simplicity of index accessors. I came up with (or found?) this method to recursively cast an object to an array.






