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 trialAdam Baldwin
1,971 PointsCan't see my output
The directions were to echo Mike's name. I can't figure out why I can not see "Mike" in the output. Workspaces keeps asking me did i echo something different.
<?php
$name = "Mike";
?>
<?php echo $name ?>
6 Answers
Ted Sumner
Courses Plus Student 17,967 PointsYou have no semicolon after your echo.
Adam Baldwin
1,971 Pointshmm i'm watching the php basics tutorial for beginners. It mentioned html briefly but nothing about css.
Adam Baldwin
1,971 PointsWell i guess it doesn't hurt to include the semicolon as good practice.
Ted Sumner
Courses Plus Student 17,967 PointsThe possible answer to the semicolon is that you really don't have only one line since there is no code between your two php statements. The other is that the challenge did not expect you to close and open the php statements so it expected the semicolon. I would have to play on a real site to see which is the correct answer.
Adam Baldwin
1,971 PointsI'm thinking something is wrong within the workspace. It accepted the semicolon at first. Then I went back to redo the challenge and then it did not accept the semicolon, but accepted the code without the semicolon. On a third try, it's not accepting the code with or without the semicolon now.
Adam Baldwin
1,971 PointsSo the solution to this problem was that i needed to move my code from line 5 to line 4. Go figure.
Adam Baldwin
1,971 PointsSo the solution to this problem was that i needed to move my code from line 5 to line 4. Go figure.
Adam Baldwin
1,971 PointsAdam Baldwin
1,971 PointsWow, it worked! Thank you. In the tutorial I watched, the instructor said that a semicolon was not needed when recalling a single line of code. So i didn't think to include it. Nor did he use it in the follow along. I appreciate your help. Thanks again.
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsI think you are confusing php with css. That is true in css but not php.
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsI just rewatched the video and you are correct about the semicolon in one line of php. That is not what I recall.
My personal practice is to always include the semicolon so I don't run into trouble. I have run into trouble forgetting the semicolon before, so now it is after every line of code I write that uses that syntax.