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

Daniel Atonge
Daniel Atonge
4,769 Points

Can't complete code challenge

Oops! It looks like Task 2 is not responding. I have compiled over and over but nothing seems to be working.

index.php
<?php

//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName .' ' .$lastName;
$fullname .= " was the original creator of PHP \n";
echo $fullname ;

?>

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Daniel,

You're really close. There are just two things.

  • Right now, you are re-assigning the to the value of $fullName. This is overwriting the original and correct value on the line above it. So, all you really need is to combine the return statement and the re-assignment into a single line (Hint: it will start with return and need some concatenation).
  • Second, and this is just because the code checker and challenges are very picky and very specific... You have a space between PHP and the \n.

Fix those up and you're all good to go. :)

Keep Coding! :dizzy:

Daniel Atonge
Daniel Atonge
4,769 Points

Thanks. It still refused. Bummer! You have not displayed the correct string

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hey Daniel,

With the corrections, it should pass. Here is the corrected code for you to compare to yours. Hope that helps you figure things out. :)

<?php
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . ' ' . $lastName;

echo $fullname . " was the original creator of PHP\n";
?>

:dizzy: