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

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.