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 the $name variable is set to string 'Mike'

under the variable $name create a if statement that test to see the $name variable is set to string 'mike'

index.php
<?php
$name = "Mike";
If($name == "Mike") {
  echon "Hi, I am"."!";

  {
  >?

1 Answer

Hey!

I can spot a couple of things you'll need to change to pass this challenge.

Here's the working code:

<?php

$name = "Mike";
if ($name == "Mike") {

}
?>

Make sure you're closing tags look like

?>

instead of

<?

If statements must be opened and closed by an opening and closing curly brace.:

<?php

if ($somethingIsTrue) {
    // Do this!
}

if statements also begin with a lowercase I.

Watch that typo on your echo statement:

<?php

 echon "Hi, I am"."!";

// should be

 echo "Hi, I am"."!";

and make sure you only answer what the challenge is asking for - I removed the echo statement from the answe :)

Hope this helps!