Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Daily Exercise Program String Manipulation

1) Use the $fullName variable 2) Display the following string to the screen. Rasmus Lerdorf was the original creator

This is what I used and I get the correct output but it gives me an error saying the fullName has to be Rasmus Lerdorf.

index.php
<?php

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

2 Answers

There is a note: Important: In each task of this code challenge, the code you write should be added to the code from the previous task.

Each step the checker will check all tasks. You have updated $fullName in task 3 so it no longer passes task 2. For task 3 you should be able to echo the string that includes the $fullName variable without updating $fullName.

jonathanbarrios
STAFF
jonathanbarrios
Treehouse Teacher

👋 Cameron Leavitt,

You are very close!

Using your code at Challenge Task 2 of 3, I get the following error: Bummer: $fullName should equal Rasmus Lerdorf and this is because the $fullName variable should only return Rasmus Lerdorf. You code is using $fullName to echo the WHOLE sentence and this is where the problem lies. I echo the WHOLE sentence using double quotes without using $fullName .= and it passed:

<?php
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = "$firstName $lastName"; // 👈 No concatenation symbol `.` needed with double quotes

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

Happy coding 🙌