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

The PHP challenge says this is an incorrect way to echo Mike. Can't figure out why

PHP basics challenge to echo Mike onto the screen. I've checked 10 times now, and I can't see how what I've typed isn't matching the tutorial video.

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

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

<h1><?php echo $name ?></h1>

3 Answers

Kevin Korte
Kevin Korte
28,148 Points

You're technically right, try removing the H1 tag and putting both php statements in the same block, separated by colons.

Erik McClintock
Erik McClintock
45,783 Points

Adam,

The issue here is that you've created an h1 tag and a second PHP block. You didn't do anything incorrect as far as actual code goes, but for the challenge, they want you to keep everything in the same PHP block.

<?php

$name = "Mike";
echo $name;

?>

Erik

That was it! Thanks, Kevin.