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!

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 Creating the Menu and Footer Adding Active States to the Navigation

Brian Larris
Brian Larris
11,864 Points

Using less variables

Would it be more efficient to use the $pageTitle variable in the conditional instead of creating a new variable to serve essentially the same purpose?

1 Answer

Brian,

You are approaching this with a really good mindset! In coding you never want to create redundant code, as it wastes computational resources and slows down your programs. I just watched that video over again and I'm not sure what you are referring to specifically, but the PHP application project videos are in a set of three. If my memory serves me correctly, a later lesson deals with refactoring and condensing code.

Brian Larris
Brian Larris
11,864 Points

Thanks Stephen. This was my first-ever question and I assumed it would post under the video from which I clicked the "Ask a Question" button. I'll try to get that worked out for my next question!