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 Daily Exercise Program String Manipulation

Mika Laakso
Mika Laakso
4,222 Points

The code does not work

Why does it not work?

index.php
<?php

//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";

$fullName = $firstName . ' ' . $lastName 
  echo $fullName . ' ' . "was the original creator of PHP"\n;
?>

3 Answers

Hey Mike - You're missing a semi colon after the $fullName assignment. You also need to put the \n inside the double quotes and you can just concatenate the second part of the string with a space at the beginning:

<?php

echo $fullName . " was the original creator of PHP\n";

Oh, I missed the \n inside the double quotes! Thanks for catching that.

Hey!

You are missing a semi-colon at the end of this statement:

<?php
$fullName = $firstName . ' ' . $lastName 

That's probably the problem.

Mika Laakso
Mika Laakso
4,222 Points

Thank you guys for the help!