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 trialChristal M Chikara
Web Development Techdegree Student 385 PointsWhat 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;
?>
1 Answer
Steven Parker
231,268 PointsWhile 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.