Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Need help on php quiz.

Here's a block of PHP code that displays the name of our website on the screen. Let's modify this to use a variable instead. Right now, the code displays the name of our website on the screen. Modify it to assign the name of our website to a variable called "name". (Don't forget to use a dollar sign in the variable name.) "I managed to solve the first task" <?php $name = "Shirts 4 Mike"; echo name; ?>

Here is the second task : Add another command after this to display the value of the variable on the screen. (Important: The code you write in each task should be added to the code written in the previous task.) I cannot understand the question clearly, I just keep on meeting bumper please help thanks :)

4 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

The first task was to write this:

$name = "Shirts 4 Mike";

The second task is to write the echo command that displays it to the screen. But you have an error in that echo command. It looks like you forgot the symbol that goes in front of variables:

echo _name;

Does that help?

<?php $name = "Shirts 4 Mike"; echo $name; ?>

Milton Centeno
PLUS
Milton Centeno
Courses Plus Student 7,940 Points

Hi Randy, My code is not passing either. Whats wrong with the code below?

<?php $name = "Shirts 4 Mike"; echo name; ?>

Thanks.

Dollar sign before name variable

<?php $name = "Shirts 4 Mike"; echo $name; ?>