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 Build a Simple PHP Application Adding a Contact Form Working with Get Variables

alexvalladares
alexvalladares
21,478 Points

Different files vs. unique one

Hi everyone!

In this stage Randy explain hoy to merge all functions defined in 3 files into one. Is there any problem in keep it in those 3 files? I mean, more php files = more request, worst performance or something like that? I guess the code is more clear and readable with 3 separated files, but just my opinion!

Thanks and regards!

2 Answers

Jeff Lemay
Jeff Lemay
14,268 Points

There is no problem with keeping 3 separate files, but best practice would be to combine where you can. You are right though, more php files = more request = marginally worse performance. Plus there's 3x more chance to have something go wrong (file name changed by accident, include() has a syntax error, etc.).