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 Parker203,202 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.