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.

ella ukpo
369 PointsFinal Quiz
$a = 1;
if ($a > 1) {
$a--;
$a += 2;
} elseif ($a < 1) {
$a++;
} else {
$a += 5;
}
$a = $a + 2;
echo $a;
1 Answer

Steven Parker
216,769 PointsTry 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.
Rich Donnellan
25,767 PointsRich Donnellan
25,767 PointsQuestion updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples.