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

Adam Baldwin
Adam Baldwin
1,971 Points

Can'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.

index.php
<?php 

$name = "Mike";

?>

<?php echo $name ?>

6 Answers

You have no semicolon after your echo.

Adam Baldwin
Adam Baldwin
1,971 Points

Wow, 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.

I think you are confusing php with css. That is true in css but not php.

I 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.

Adam Baldwin
Adam Baldwin
1,971 Points

hmm i'm watching the php basics tutorial for beginners. It mentioned html briefly but nothing about css.

Adam Baldwin
Adam Baldwin
1,971 Points

Well i guess it doesn't hurt to include the semicolon as good practice.

The 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
Adam Baldwin
1,971 Points

I'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
Adam Baldwin
1,971 Points

So the solution to this problem was that i needed to move my code from line 5 to line 4. Go figure.

Adam Baldwin
Adam Baldwin
1,971 Points

So the solution to this problem was that i needed to move my code from line 5 to line 4. Go figure.