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 Enhancing the Collection

Can you have the same method names in two different files for the recipes exercies?

Will there be conflict if you have same method names in two different files for this exercies? Even though one file is recipe.php and the other is recipecollection.php ?

2 Answers

Algirdas Lalys
Algirdas Lalys
9,389 Points

Hi jaycode,

There should't be any problems if those both files have CLASS and in those seperate classes you have same method names.

Thanks Algiras. Are they the same shared method? Or completely separate?

Ryan Dainton
Ryan Dainton
17,164 Points

Hi jaycode

They will be completely separate methods. If they are defined on separate classes, they will only be accessible via that class.