Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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.
<?php $firstName = "Rasmus"; $lastName = " Lerdorf"; $fullName = ($firstName .= $lastName); echo($fullName); ?>
Steven Parker218,861 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.