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

not getting correct answer

what will be the value of a

I am getting 8

Algirdas Lalys
Algirdas Lalys
9,389 Points

Hi vardan gupta,

if you are talking about his quiz question. Then you are right.

// a = 1
$a = 1;
// wont pick (false)
if ($a > 1) {
    $a += 2;
// wont pick (false)
} elseif ($a < 1) {
// will pick (true)
} else {
    // 1 + 5 = 6
    $a += 5;
// 6 + 2
$a = $a + 2;
// 8
echo $a;