2

My question is a little bit vague. Why do we use stdClass(es) to represent objects in Drupal 7? is there a practical use to it ? Why not just using arrays ?

1 Answer 1

3

Generally speaking, objects are used for storing structured data and arrays for lists or collections.
It even logically makes more sense. Node is an object with properties; it's not an array of properties.

See this answer posted on SO as an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.