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

Rick Colella
Rick Colella
7,327 Points

What is wrong with this challenge answer?

I'm baffled as how why it keeps saying the answer is wrong. I've gone back and reviewed the previous video and copied the code by character. I even tried adding html, body and doctype into the code to similar a real php doc but nothing.

Am I doing something wrong in this code or is it a bug?

The challenge: "Now echo Mike's Name To The Screen." Response: "Bummer! I am not seeing the word "Mike" in the output. Did you echo something different?"

index.php
<?php
  $name = "Mike";
?>

<?php echo $name ?>

3 Answers

Abe Layee
Abe Layee
8,378 Points

All you have to do is pass the $name to the echo like this which will echo Mike on the screen.

<?php
  $name = "Mike";
    echo $name;  // this is calling Mike variable. 
?>

Yep. The important part here is that the challenge will only accept one php code block.