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 trialTony Brackins
28,766 PointsUnder 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
Treehouse TeacherTony;
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
Elijah Collins
19,457 PointsTony 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
15,021 Pointsthank Elijah Collins, you saved my time.
Andres Altuve
16,274 PointsHi 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" ;}
?>
```
risetteshaw
2,533 PointsThis worked for me:
<?php $name= "Mike"; if ($name == "Mike"){ echo 'Hi, I am Mike!'; }; ?>
Brandon Cleveland
11,134 PointsYou did not have a semicolon after ($name = "Mike")
rosinapissaco
13,401 Pointsrosinapissaco
13,401 PointsThanks. I have been trying it 10 times!