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

Olga Aznabakiyeva
Olga Aznabakiyeva
688 Points

The output displays correctly, the code is correct, but the course says I did not use $fullname and doesn't go further

Makes me go to the previous task, but when I "check" the previous one it says "Well Done"

index.php
<?php

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Olga,

You have Task one correct, but how you achieved the final output in not what the challenge is looking for.

You do pretty much have it, but the Task wants you to use the $fullName variable to echo out string. So, instead of concatenating the variable to the string and echoing the new variable, use the variable inside the echo statement.

I don't usually give the answer, but your code is technically correct, so I will provide what the challenge is expecting for you to see. Keep in mind, though, how picky challenges can be. :)

<?php

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

Keep Coding! :dizzy: