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 trialCameron Leavitt
3,651 Points1) 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.
<?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
KRIS NIKOLAISEN
54,972 PointsThere 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
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 🙌