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 trial
Why is This Wrong?
The Output is correct and i did the logic correct maybe I didn't do it in the way the computer Wanted I set the Variable to "Rasmus" Which is what it wanted but it said it was wrong my code isn't incorrect from what I can Tell.
$firstName = "Rasmus";
$lastName = " Lerdorf";
$fullName = ($firstName .= $lastName);
Steven Parker229,005 Points
I see three issues that would affect the challenge but would not be seen by looking only at $fullName:
- there is a stray space at the beginning of the string
- the "
.=" operator modifies $firstName, but the challenge is expecting it to remain as it was ("Rasmus")
- you'll need to add a space between the combined names without changing the individual names
The bummer message isn't very helpful. But one reason the challenge will fail is you have a space before Lerdorf in your lastName variable. Instead of a space there you can add one with concatenation to fullName as follows:
$fullName = $firstName . ' ' . $lastName;
Ignore the error message about the firstName. That is why I said the bummer message isn't very helpful.