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

PHP

Trouble with the code challenge

I'm having trouble with a code challenge, how do i write this code?

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.

I've named the variable correctly but I'm stuck on how to get the spacing right and I have re-watched the video 6 times already, please help

Hugo Paz
Hugo Paz
15,622 Points

Hi Phillip,

Could you post the code you tried so far?

sure, this is what I've tried:

$fullName =""; $fullName = $fullName . "$firstName: " . "$middleName: " . "$lastName: ";

Hugo Paz
Hugo Paz
15,622 Points

Ok i see the problem,

<?php

$fullName = $fullName . " " . $firstName . " " . $middleName . " " .$lastName;

?>

Try it like this.