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 PHP Basics (Retired) PHP Data & Structure PHP Variables

Yvette Pascacsio
Yvette Pascacsio
5,199 Points

Please help me understand what I'm doing wrong.

My cannot wont pass, what am I missing?

<?php $name = "Mike"; ?>

<?php echo $name ?>

index.php
<?php $name = "Mike"; ?>

<?php echo $name ?>

2 Answers

Erik McClintock
Erik McClintock
45,783 Points

Yvette,

Your code is correct, but they want you to put your echo statement in the same code block as your variable declaration. You currently have opened up a second code block to add your echo statement.

You have:

<?php $name = "Mike"; ?>

<?php echo $name ?>

You want:

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

Also make sure to add your closing semi-colon after your echo statement!

Erik