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 trialIsabelle Oneal
14,267 Pointsi'm having trouble with task 2: "Now echo Mike's Name To The Screen."
its saying that i am wrong but im copying it from the screen.
Steve Berrill
20,016 PointsHi Isabelle,
Edit: As Dustin pointed out I need to explain to you why this is the answer. ill do my best
- Set the variable
$name
- Assign it a string value
"Mike"
- Finish the line with a semi colon
;
- Echo the variable name
$name
to print out the name - Make sure to add a
;
at the end of this also, or it wont work.
Put it all together like this:
<?php
$name = "Mike";
echo $name;
?>
Dustin Matlock
33,856 PointsHey Steve, Treehouse asks that when you provide an answer to a code challenge, you also provide an explanation. This way students are receiving benefit from the course material. If you could please edit your response to include why the answer you've provided is correct, that would be great. Thanks!
Jason Anello
Courses Plus Student 94,610 PointsHi Steve,
When giving an answer to a question you should post it as an answer and not as a comment to the question. Please consider re-posting as an answer.
Dustin Matlock
33,856 PointsThat's right, Steve Berrill, if you want to possibly receive credit, you'll have to post your response as an answer.
2 Answers
Isabelle Oneal
14,267 Pointsi wrote the same thing Steve Berrill but as soon as i refreshed the page and did it again it passed me. Thank you!
Steve Berrill
20,016 Pointsthats great, glad I could comfirm it for u then :)
ross winters
10,415 PointsAfter refreshing the screen, this code finally passed:
<?php $name = 'Mike';
if( $name == 'Mike') {
echo 'Hi, I am Mike';
}
?>
It's not exactly the same sentence ( missing a "!") but I don't care.
Dustin Matlock
33,856 PointsDustin Matlock
33,856 PointsHi, Isabelle! Can you post your code? Thanks.