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 (Retired) PHP Conditionals & Loops Conditionals Challenge

Under the variable $name create a if statement that test to see that the $name variable is set to the string 'Mike'.

Help!

This is what I have so far:

<?php $name = "Mike" if($name == "Mike"){ $info = 'Hi Mike'; } else{ $info = "Im not Mike" } ?>

5 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Tony;

There is an issue at the moment with the Treehouse challenge engine. They are aware of it and are working on it. See this post for additional information.

Ken

Thanks. I have been trying it 10 times!

Tony Brackins not sure if you still need help, but here is what passed for me

<?php 

$name = "Mike";

if($name == "Mike") {
echo "Hi, I am " .  $name . "!";
}

?>
Ashenafi Ashebo
Ashenafi Ashebo
15,021 Points

thank Elijah Collins, you saved my time.

Andres Altuve
Andres Altuve
16,274 Points

Hi tony, the problem is you are testing your variable inside your variable.

Example:

<?php 

$name = "Mike";

 if ($name == "Mike") 

          echo "Hi Mike";   

        }else{

         echo "Im not Mike" ;}

?>



            ```

This worked for me:

<?php $name= "Mike"; if ($name == "Mike"){ echo 'Hi, I am Mike!'; }; ?>

Brandon Cleveland
Brandon Cleveland
11,134 Points

You did not have a semicolon after ($name = "Mike")