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 trialZoDo .
13,135 PointsCreate a third string named 'fullName' that combines the $firstName and $lastName variable to make the string "Rasmus ..
I have try this code on workspace and seems to work just fine....but still i have errors on the test. any suggestion?
<?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 ?>
<?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
?>
7 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're doing great. What if I added this additional instruction? Echo out the final string without changing the value of $fullName. Every time you are concatenating onto the end of the $fullName variable thus changing its value. At the end of this, your $fullName will hold "Rasmus Lerdorf was the original creator of PHP.\n". But $fullName should only ever contain "Rasmus Lerdorf".
Take this example:
$myName = "Jennifer";
echo "My name is $myName";
In this example, I use the value inside $myName and expand it directly in the string I'm echoing out without changing its original value.
I think you can get it with these hints, but let me know if you're still stuck!
Jon Tolentino
5,332 PointsHope this Help Bro!!
$firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullName = $firstName . ' ' . $lastName; echo "$fullName was the original creator of PHP \n";
ZoDo .
13,135 PointsHi, Jennifer, thank you a lot I have copied your code but it still does not work, seems this challenge has something personal with me :)
Iaan Tatenda Ruwiza
12,712 Pointsit works just add a period to jennifer's code
ZoDo .
13,135 PointsHi Jennifer, well i think i figure it our bu it seems to give me still an error Here is my code:
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullName = "$firstName " . "$lastName";
echo "$fullName was the original creator of PHP \n";
?>
Thank You.
Jennifer Nordell
Treehouse TeacherHi there! You did get it! Except for some reason, it really doesn't want you to have a space between the new line. So if IO change it to this, it passes:
echo "$fullName was the original creator of PHP\n";
Hope this helps!
Zachary Scott
1,650 PointsI found this to work well:
<?php
$firstName = "Rasmus";
$lastName = "Lerdorf";
//Create a third variable named fullName that combines the $firstName and $lastName variables to make the string Rasmus Lerdorf.
$fullName = $firstName . " " . $lastName;
// 1) Use the $fullName variable
// 2) Display the following string to the screen.
// Rasmus Lerdorf was the original creator of PHP.
// 3) Use an escape character to add a newline to the end of the string.
echo $fullName . " " . " was the original creator of PHP. \n";
?>
Shuvam Roy
2,753 Pointsecho "$fullName was the original creator of PHP.\n";
joo
Python Development Techdegree Graduate 16,498 Points<?php
//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = $firstName." ".$lastName;
echo $fullName. " was the original creator of PHP.\n";
?>