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 trialPeter Dancause
4,072 PointsCan't figure it out.
I'm stuck, I've tried every different syntax combination I can think of. Can someone please tell me why this will not work?
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";
$fullname = "$fullname was the original creator of PHP \n";
echo $fullname;
?>
2 Answers
Benjamin Larson
34,055 PointsHi Peter -
Rather than assign the whole string to the $fullName
variable, you should just echo out the $fullname variable inside that string. Basically echo what you already have, just don't reassign it to $fullName
. Also, it will want you remove the space you have before the linebreak (\n
).
Antonio De Rose
20,885 Points<?php
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName $lastName";//till this point correct
$fullname = "$fullname was the original creator of PHP \n";//do not store this into variable echo it from here
//take the additional space after the PHP in the right above line
//make sure you, use the double quotes at the right place, just before the letter 'w' in word was
//check for how do you concatenate string with variable using the dot operator
echo $fullname;//take off this line
?>
Peter Dancause
4,072 PointsPeter Dancause
4,072 PointsThank you. I had nearly pulled out all of my hair. The wording of the challenges are confusing sometimes.