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

Hello, I feel I have put in the code correctly but the quiz still keeps saying it's not displaying. Please help me.

I believe my code should be attached to this message.

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

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

1 Answer

Grace Kelly
Grace Kelly
33,990 Points

Hi Hector, while your code is perfectly valid and would work in a "real life" scenario, this code challenge wants you to echo out the $name variable in the same php code block where you declared it, like so:

<?php

$name = "Mike";
echo $name;

?>

Hope that helps!!

Yes, that helps very much. Thank you for explaining it to me.