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 Data & Structure PHP Variables

Chris George
Chris George
10,740 Points

why is this not working?

The problem is saying to echo Mike's name to the screen. I am not sure why this is not working.

index.php
<?php 

$name = "Mike";

?>

<!DOCTYPE HTML>
<html> 
  <body> 
    <p><?php echo $name ?></p>
  </body>
</html>

3 Answers

Jeff Lemay
Jeff Lemay
14,268 Points

You did too much here. They just want you to create the variable and then echo it, you don't need to create a DOCTYPE or add head/body tags.

<?php
$name = "Mike";
echo $name;
?>

NOTE: everything must be in a single php-block in order to pass this challenge.

Brandon Bolin
Brandon Bolin
760 Points

I think you are missing the semi colon after your $name echo.

Chris George
Chris George
10,740 Points

I tried that too and it still says that it is wrong