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

Jorge Gonzalez
Jorge Gonzalez
3,574 Points

For challenge 2, this does not work. :

Why does nothing echo?

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

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

4 Answers

Try removing the space:

<?php echo $name; ?>
Jorge Gonzalez
Jorge Gonzalez
3,574 Points

Wow guys. Thank you Ted and Pedro for the prompt response!

Ted Sumner, the issue is "a space" as I mentioned and that's not to be confused with "white space". If you look closely to the second time he opens his php tag you will notice he brakes it by inserting a space between the question mark and the letter p and that's the reason why its not getting parsed/rendered. That aside, your code provides the optimal answer to the challenge.

I see what you mean now. I don't know that what he wrote will pass even if it is otherwise correct.

The white space is not the issue. You have more code than the challenge asked for. This passed for me:

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