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

I don't why it's wrong, I've made the variable string inside the php, declared it. It doesn't show up and it, its wrong.

I've made the variable string and declared it in the one line for the html and it won't show up.

It's really cut and dry to do this task and I don't understand what could be wrong.

$name = "Mike";


<!DOCTYPE html>

<h1><?php echo $name ?></h1>
Darren Joy
Darren Joy
19,573 Points

Is this for a code challenge or something?

1 Answer

Darren Joy
Darren Joy
19,573 Points

OK, I went back and if it is for the challenge it failed me when I tried this:

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

but passed me when I put it all in one tag

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

Sometimes the code challenges are very specific in what they are looking for as an answer