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!
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
Christal M ChikaraWeb Development Techdegree Student 385 Points
What am I doing wrong?
I have been asked to concat the two variable. However when I attempted to simply concatenate using the (.) operator. The results stated that I had not left any space between the two variable. I have added some space and now the results are stating that the variable $firstName is not in use.
<?php $firstName = 'Rasmus'; $lastName = 'Lerdorf'; $fullName = ''; $fullName .= $firstName; $fullName .= ' '.$lastName; echo $fullName; ?>
Steven Parker227,989 Points
While your code would functionally do the job, the challenge is probably expecting to see the variable assigned using one single statement, like this:
$fullName = $firstName . ' ' . $lastName;
Also, for task 2 you don't need to "echo" anything. Some challenges can get confused if you do anything besides what the instructions ask for.