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

Eoghan Uttley
Eoghan Uttley
1,076 Points

100% sure I'm filling this in correctly..what gives

.

index.php
<?php

$name = "Mike";

?>

<html>
  <head>

    <title><?php echo $name ?> | Treehouse Profile</title>

  </head>
</html>

It's a good idea to post the question. Not everyone who can help has necessarily seen the question.

Eoghan Uttley
Eoghan Uttley
1,076 Points

Declare variable called name with value of Mike, echo $name to screen.

Just ran through the challenge, i think Holger Liesegang is correct

2 Answers

Holger Liesegang
Holger Liesegang
50,595 Points

Hi Eoghan Uttley !

You might just want to add the echo statement under the variable declaration like this and you can pass the challenge:

<?php
$name = "Mike";
echo($name);
?>
Jan Van Raemdonck
Jan Van Raemdonck
22,961 Points

I think you forgot a semicolon

<?php echo $name; ?>

EDIT

if you only want to echo 1 variable you can also use the shorthand notation:

<?=$name?>
Eoghan Uttley
Eoghan Uttley
1,076 Points

Still doesn't work no :(