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 PHP Basics PHP on the Web Final Quiz

ella ukpo
ella ukpo
369 Points

Final Quiz

$a = 1;
if ($a > 1) {
    $a += 2;
} elseif ($a < 1) {
} else {
    $a += 5;
$a = $a + 2;
echo $a;
Rich Donnellan
Rich Donnellan
25,767 Points

Question updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples.

1 Answer

Steven Parker
Steven Parker
216,769 Points

Try writing the entire thing on a piece of paper (using separate lines as in the original), and then, one step at a time, write down what value $a would have after that step. Skip any step that would not run because of a conditional (if/elseif/else) test. Then when you get to the last line, you should have the correct answer.