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

General Discussion

Concatenation code challenge.

I'm stuck on the second question, which is :Create a variable called fullName and assign it a value equal to the concatenation of the firstName variable, a space, the middleName variable, a space, and the lastName variable.

My answer is: $fullName = $firstName . " " . $middleName . " " . $lastName;

The response that I receive is: Bummer! $fullName is set, but it's not the concatenation of $firstName, $middleName, and $lastName with spaces between them.

I do not see what I'm doing wrong. May someone help me out , thanks.

John Breiner
John Breiner
6,918 Points

Ok I'm not entirely sure but you may be missing a space. $fullName = $firstName . " " . $middleName . " " . %lastName;

3 Answers

Rasmus Boserup
Rasmus Boserup
973 Points

Hi,

Not sure what course you are on, but i am guessing you might need some +'es in there :-)

Try: $fullName = $firstName + " " + $middleName + " " + $lastName;

Let me know if that works?

John Breiner
John Breiner
6,918 Points

Ok I'm not entirely sure but you may be missing a space. $fullName = $firstName . " " . $middleName . " " . $lastName; That should work.

$fullName = $firstName ." ". $middleName ." ". $lastName; This worked , but thanks for trying to help guys :) .