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 trialZakai Sabalie
3,362 PointsPHP Code Challenge: Variables
I have been doing a PHP Quiz. I keep getting a error on this code:
"Bummer! Make sure you're echoing the variable you just set in the last step."
Here is the code that I have produced:
<?php
$name = "Shirts 4 Mike";
echo _name;
?>
I know that I am doing this correctly, I figure that the code challenge is not working properly.
2 Answers
Marcus Parsons
15,719 PointsHey Zeki Sabalie,
I edited your markdown so it would render on here in a more readable format. You can check the Markdown Cheatsheet for how I did that.
But, it looks as though you are echoing _name when you should be echoing $name. All PHP variables begin with a $ sign and when referencing them, you always put the $ sign before the variable name. So, your code should read:
<?php
$name = "Shirts 4 Mike";
echo $name;
?>
Zakai Sabalie
3,362 PointsThank you sir.
Marcus Parsons
15,719 PointsMy pleasure, Zeki! Good luck!
Marcus Parsons
15,719 PointsMy pleasure, Zeki! Good luck!