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 trialJustin Long
5,050 PointsCan't get past "Echo Mike's Name" in PHP basics
I can't seem to get past this code challenge. #2 on PHP variables. I've copied and pasted my code into a workstation and it works perfectly, but still can't get past the challenge. I've tried different browsers and different ways of typing the code. For instance, I've tried to echo within the first PHP code block as well as trying to echo it outside of the variable setting code block.
Here is the link to the challenge in question...
http://teamtreehouse.com/library/php-variables
<?php
$name = "Mike";
?>
<?php echo $name ?>
3 Answers
Robert Karlsson
8,021 PointsYou need to put a semicolon after the $name variable after the echo. This is to tell the server that reads the PHP that the statement is complete.
<?php echo $name; ?>
Justin Long
5,050 PointsOk, figured it out. I guess. I just kept hitting the check work button in frustration and it decided to let me pass.
raydelprado
10,350 PointsYeh this was very weird. I tried both, <?php echo $name; ?> and <?php echo $name ?> eventually I even tried <?php echo .$name. ?> for no particular reason. As soon as I removed both the periods and clicked the submit button, it passed...
So in the end my answer was
<?php echo $name ?>
o.O
Justin Long
5,050 PointsJustin Long
5,050 PointsThanks for your help!
Sadly, I tried this and it didn't work.