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

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