PHP json_decode: Object to Associative Array?

In php if a function returns an associative array, you can't access its members directly as foo()'xxx'. However if it returns an object you can access the members as foo()->xxx.

In my oppinion its a way to accentuate the difference between a list (in php expressed by a numeric array) and an entity (the object). This could be more readable, because one can read be the used accessor ( or ->) what kind of data is accessed.

Personally I always ask for an associative array and find it easier to work with than the object returned when $assoc=false. But I would say the majority of other people's code I've seen (largely various web service client libraries) has used json_decode with $assoc=false and objects instead of associative arrays. I think it's mostly a matter of preference though, as I've not seen any particular strong reason for choosing one way or the other.

Sorry for the non-answer :-).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions