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 trialSimingaye Dube
2,587 PointsUnder the variable $name create a if statement that test to see that the $name variable is set to the string 'Mike'?
Under the variable $name create a if statement that test to see that the $name variable is set to the string 'Mike'.
<?php
$name = "Mike";
if ($name = "Mike") {
echo Mike;
?>
1 Answer
Alexander Davison
65,469 PointsGreat job! There are some errors, though. First, you made the $name variable, check. Second, when you want to get the value of $name, you need to use the exact same name, not the content of the variable. Lastly, you need the closing curly brace } for the if condition. Try this code:
<?php
$name = "Mike";
if ($name == "Mike") {
echo $name;
}
?>
Hope that helps!
David Bath
25,940 PointsDavid Bath
25,940 PointsWhat is your question? If you got an error, it's probably because you forgot your closing curly bracket.