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 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.