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 to print out Mike and I have no idea what's wrong here..


$name = "Mike";

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

That's the code.. and I did exactly what the instructor said..

2 Answers

Hi Taeho,

The challenge doesn't seem to like 2 separate php blocks. Echo the name in the 1st php block and remove the second php block.

Michael Jensch
Michael Jensch
8,038 Points

Furthermore you need to set a semicolon in the second php block. Example:

<?php echo $name; ?>

Hi Michael,

While it's good practice to end every statement with a semicolon it's technically not needed when it's the last statement in a block. The closing ?> is capable of ending the last statement.

it is indeed enough, but I find it always good to add in for consistency ;) It can also introduce bugs if you ever merge two blocks!