PHP PHP Arrays and Control Structures PHP Conditionals Compare

Garrett Peters
Garrett Peters
5,807 Points

Is there an else missing in this quiz question?

What will be displayed in a browser when the following PHP code is executed:

<?php $a = "Alena"; if ($a = "Treehouse") { echo "Hello Alena, "; } echo "Welcome to Treehouse!"; ?>

2 Answers

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,289 Points

There is no else missing. The trick is to think about the tip and the use of the assignment operator in the if statement.

Garrett Peters
Garrett Peters
5,807 Points

I see it now. Thanks Kris.