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

Annalyn Aguilar
PLUS
Annalyn Aguilar
Courses Plus Student 150 Points

<?php echo $name ?> Will print the name right? why it says BUMMER when I check my work?

PHP Basic

index.php
<?php

$name = "Mike";

?>
<?php echo $name ?>

2 Answers

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

Hi, Annalyn. While what you have will work technically, the challenge wants you to put everything inside one php block. In addition, while you can omit semicolons for single-line blocks of PHP, it's always a good idea to include them so you don't run into errors if you decide to add on more code later.

Jeff Lemay
Jeff Lemay
14,268 Points

This challenge seems to come up every other day where people run into the same issue. Is it possible for Treehouse to add to the BUMMER saying "Make sure your code is in a single php block"?

Annalyn Aguilar
Annalyn Aguilar
Courses Plus Student 150 Points

I tried that one too. I tried all the things that I know. I'm sure it's a technical reason.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Maybe someone can ask this in treehouse support. So we can get such a message on there. :-)

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Jeff Lemay : I'm sure it would be possible from a technical perspective, but I don't work for Treehouse, so you'd have to contact support.

Annalyn Aguilar : I just tried the challenge, and it passes. You need to do something like this:

<?php

$name = "Mike";
echo $name;

?>
Annalyn Aguilar
Annalyn Aguilar
Courses Plus Student 150 Points

Yup. I also did that and it passed. That was right after I posted this q.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

I can't think of a reason based on what I've learned today. Seems odd.

Is it looking for a different variable name of a different string? The code challenges look for something very specific. :-)

Annalyn Aguilar
Annalyn Aguilar
Courses Plus Student 150 Points

Nope, my code is right. I tried many times like

<?php

$name - "MIke"; echo $namel

?>

I still get a Bummer result.

I tried it again after posting and I know that I am correct. Browser problem I guess or a bug on Treehouse. Thank you for your reply.

Jeff Lemay
Jeff Lemay
14,268 Points

This code is not correct. You used a dash to define the name variable instead of an equal sign and the echo statement is for "namel" instead of "name".

What you posted originally was correct, the challenge just wants you to use a single php block like Ryan suggested in the other answer.

Annalyn Aguilar
Annalyn Aguilar
Courses Plus Student 150 Points

Lol yeah, the second one is really wrong. That is not a copy and paste, I was typing so fast :)