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 trialJairo Montenegro
3,687 Points<?php $name = "Mike"; echo "$name"; ?> The online interpreter won't accept this. Help
What is going on?
<?php
$name = "Mike";
echo "$name";
?>
4 Answers
Tony Nguyen
24,934 PointsHey Jairo,
Your putting in the string:
echo "$name";
This is not correct since your output will be a string instead of the variable that contains the value of the name "Mike". You will need to get rid of your quotes like so:
echo $name;
Abe Layee
8,378 PointsBy adding quotation mark around the the var name, it becomes a string.
<?php
$name = "Mike";
echo "$name"; // this is a string
echo $name; //correct way
?>
jason chan
31,009 Pointsyou don't need quotes in variables you already defined it.
quotes are only for strings.
Logan Eppley
Courses Plus Student 26,697 Points<?php
$name="Mike";
echo $name;
?>
If that does not work, I recommend that you refresh the browser and start the code challenge over again.
Jairo Montenegro
3,687 PointsJairo Montenegro
3,687 PointsHey man thanks, I've tried that as well. What else could it be?
Tony Nguyen
24,934 PointsTony Nguyen
24,934 PointsMake sure that your entire code looks like this: