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 trialSultan Baig
Courses Plus Student 18,002 PointsCode challenge on PHP basics
So, I'm trying to pass code challenge number two on PHP basics. First question passes, "Set variable name = to Mike. Code is <?php $name = "Mike"; ?>
Second question is echo name to screen. Code I am using is <?php echo $name; ?>
This is not passing.....error I get is "Mike is not in your output."
11 Answers
Dan Martin
33,150 PointsThey are looking for it contained in the same code block...
<?php
$name = "Mike";
echo $name;
?>
Tim B
2,586 PointsFor some reason, your echo and variable have to be in the same php tag, dont put the echo in a seperate block or it wont pass.
Chuck Powers
13,155 PointsInstructions need to be modified or the challenge does. the video and workspace focused on php blocks inside of the html, and I don't see how solving the challenge this way fails the provided instructions. Minor tweak. Just change the wording of the instructions or change the correct output.
Judith Schenten
2,828 PointsYou are so right - but until now nothing has changed in this challenge – this is annoying!
Sultan Baig
Courses Plus Student 18,002 Pointsahhhh.....thanks Dan
Maribel Falcon
10,918 Points: ) Thanks...!
Jason Larkin
13,970 PointsI am having the same problem and this solution doesn't work for me. Can anyone help?
Dan Martin
33,150 PointsCan you copy and paste what you have? Might be slightly off.
Jason Larkin
13,970 Points<?php $name = "Mike"; echo $name; ?>
Why doesn't it work for me? Please help!
Dan Martin
33,150 PointsNot sure what browser you are using , but try the latest stable chrome. Or even restart your browser. It worked for me, just copying your code.
Jason Larkin
13,970 PointsHi Dan, I'm using the latest version of Chrome. I don't know what it could be?
Dan Martin
33,150 PointsDid you try shutting chime completely down, and restarting. Many times for me FB running in the background will mess up the browser after long periods of time.
Jason Larkin
13,970 PointsThank you Dan, I shut everything down but Chrome and it finally worked! Thanks again!
Mark Bradshaw
Courses Plus Student 7,658 PointsThanks for this help. I was down to pulling out my last hair follicle. Cheers.
Matthew McLennan
10,315 PointsThe above worked for me but I had to delete any blank lines below. It should be spread over 4 lines.
Robert Ramirez
3,644 PointsSpreading the code over 4 lines as suggested by Matthew is best practice. It makes the code more readable and visually organized. When we do a variable assignment as in $name ="Mike"; that's all we are doing. If we want to output the code to he user's screen (browser), then we must either use the echo or print command. Hope this helps.