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

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; ?>