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

Mike not displayed in output

This is the code I input,

<?php

$name = "Mike";

?>

<p><?php echo $name ?></p>

I was told I input the variable correctly but when I echo It says that Mike's name isn't displayed and asks if I input something else. What did I do wrong? I also tried using;

<?php

$name = "Mike";

?>

<?php echo $name ?>

3 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Grant,

The challenge is simply asking for you to echo out the $name variable within the same code block so instead you just need the below.

<?php

$name = "Mike";
echo $name;

?>

Echo statements need a semi-colon at the end just like other PHP statements.

<?php echo $name; ?>

Thanks so much for your responses guys. I was over-analyzing and forgetting the semi-colon.