Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.