Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Simple PHP Application Working With Functions Creating the Shirt Display Function

Concise Code

Not using the .= (e.g., $output .= "more text"; vs. $output = $output + "more text";) and ++ (e.g., $count++; vs. $count = $count + 1;) operators makes my brain hurt! :-)

Adam, No freaking kidding...I kept saying "why?!" make it stop! Or rather, don't show me what I shouldn't do! Thanks for the laugh!

3 Answers

Aaron Graham
Aaron Graham
18,033 Points

As far as the output goes, find yourself a good template engine. They make generating your output much more readable. For example, if you take the Laravel course, it talks a little about Blade.

Thanks for the recommendation. I am definitely going to take the Laravel course after I finish the PHP and MySQL courses.

While the code may not be concise, best practice or "modern PHP", it is still very helpful for beginners. Beginners need to see the long and detailed way before they can absorb the shortcuts.

Frameworks like Laravel are shortcuts that can only be understood once one has gone through the long/"old-fashioned" way.

Children learn additions and subtractions by hand before they use a calculator, because they first need to understand the concept. Nobody should use ++ before they understand that it really means + 1. It helps to write code the long way a few times to digest the materials.

I think Randy's approach makes sense pedagogically speaking. I hope TeamTreehouse will continue to pursue sound instructional design practices.