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

Bartosz Jozwiak
PLUS
Bartosz Jozwiak
Courses Plus Student 705 Points

It won't accept my code.

It won't accept this code. Why?

<?php
$name = "Mike";
if ( $name == "Mike")
{
  $statement = "Hi, I am Mike"
};

?>

3 Answers

Logan R
Logan R
22,989 Points

You misplaced your semi-colon.

Instead of putting it after the }, you need to put it after the statement.

<?php
$name = "Mike";
if ( $name == "Mike")
{
  $statement = "Hi, I am Mike";
}

?>

Hope this helps :)

Richmond Lauman
Richmond Lauman
28,793 Points

Hi Bartosz. In your if statement you have a semi colon where it does not belong and you are missing a semi colon on a statement where it does belong.

Hi Bartosz,

It's a good idea to post the solution so that others with a similar problem will have the solution.

In this case, it looks like there was 2 more problems beyond the missing semicolon.

You needed to echo the string and it needed an exclamation mark at the end.