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 trialKevin Parine
2,402 Pointsstill no...
why not
<?php
//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName .= "$firstName $lastName";
echo $fullName. ' was the original creator of PHP.'."\n";
?>
2 Answers
Jennifer Nordell
Treehouse TeacherHi Kevin Parine! The problem actually lies in the declaration of the $fullName
variable. To be honest, I'm not sure how it made it past the second step. When you first set up a variable, you assign it a value. This makes it no longer "undefined". Because you are using the .=
as a concatenation operator instead of assigning the value $firstName $lastName
to it, you are actually concatenting $firstName lastName
onto something that is undefined.
The solution is to simply delete the .
(period/full stop) from in front of the equals.
// You wrote
$fullName .= "$firstName $lastName";
// Should be
$fullName = "$firstName $lastName";
Hope this helps!
Kevin Parine
2,402 PointsThanks, your explanation was clear. I see why I was wrong to try and concatenate it.