Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Object-Oriented PHP Basics Building a Collection Creating a Collection

Tom Hudock
Tom Hudock
855 Points

Objects holding a group of objects?

I'm a bit confused by this video. Alena says an object can hold a group of objects. But it seems like the "group of objects" is simply an array being stored within a single object.

Can someone please clarify what she is talking about when she says an object can hold a group of other objects and whether the group of objects is actually just an array being stored within a single object?

Thanks.

Daniel Li
Daniel Li
15,244 Points

Think about it this way a folder is an object to hold sheets of paper (other objects) which is true of plain arrays too. But with the folder as an object you can write custom method to extend its functionality. I.e. a custom sort method to sort papers in order etc.