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

I have no idea what I did wrong

working my way through php and failing. it should print "Mike" on screen.

index.php
<?php
$name = "Mike";
?>
<html>
<body>
  <p><?php echo $name ?></p>
</body>
</html>

you forgot a semicolon after $name

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Eddie,

This challenge doesn't ask for you to add any HTML around your echo statement which is one reason why it's failing, the other reason is the echo statement has to be on the line directly below your $name variable which a requirement of the challenge.

<?php
$name = "Mike";
echo $name;
?>

You had the right mindset like other students, but the challenge wording seems to have thrown you off.

Happy coding!

Albert González
Albert González
22,953 Points

You forgot the semicolon ";" after variable $name:

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

Try it!