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

PHP Basics Challenge question...Whats wrong with my code....again :(

So the challenge is to 1) Use the $fullName variable to display the following string to the screen. "Rasmus Lerdorf was the original creator of PHP" 2) Use an escape character to add a newline to the end of the string.

I view this, and it comes up as needed, "Rasmus Lerdorf was the original creator of PHP" Yet when I submit, I get a message saying that task 2 is no longer correct. I thought the object was to change $full name to not just Rasmus Lerdorf (as instructed by task 2) but that now it should say "Rasmus Lerdorf was the original creator of PHP"...?? So perplexing :'(

index.php
<?php

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


?>

1 Answer

Martin Balon
Martin Balon
43,651 Points

Hi Sasha, the problem is, that at last line you are assigning the fullname and string to variable $fullName. They want you to echo out a sentence using variable fullName as part of the sentence. Look at this code and see the difference.

<?php

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


?>

Oh my gosh! I over thought it. I keep doing that. Thank you so much for helping!