Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Simple PHP Application Adding a Contact Form Concatentation

Simple concatenation php issue, I can't spot where my code is wrong.

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.


$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullName = $firstName." ".
$middleName." ".

echo "The designer at Shirts 4 Mike shirts is named $fullName";


Are you sure that code is not passing?

I copied your code block and pasted it into the challenge and it passes all the way up through task 3.

Hi Guys,

That was my first issue / bug on treehouse and the feedback was awesome.

  • I went through the code challenge again and the exact same code worked.

It could have been an issue with the refresh button or caching of the page. I don't honestly know why it didn't pass that's why I was asking.

Thanks for the feedback on this challenge, helped me understand some of the rules a bit better.

2 Answers

Hey Dillion,

It's a very simple mistake. You're suppose to declare and concatenate the $fullName variable outside of the string.


$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullName = $firstName." ".$middleName." ".$lastName;

echo "The designer at Shirts 4 Mike shirts is named ".$fullName;



Actually, regardless of what the challenge may call for, his version of the echo statement is actually syntactically correct. When you use double-quotes on a string, any variable that is called within will have its value displayed. Single-quotes, on the other hand, will display the name of the variable and not the value. If that is what's making Dillon's challenge failing, I'd advise you to fix the challenge as it gives people new to the language false information and speculation.


I'm only just a moderator, so i'm just helping anyone with challenges that I may have passed already. I wasn't the one who created the challenge. I'm here to learn just like everyone else who is a Treehouse member. Any bugs should be reported directly to Treehouse. Thanks for the info Dillion.


I've verified that it does pass with double quotes and variables inside.

I'd tend to agree with you that it should pass both ways, dillon's or David's, if the instructions said to produce a certain output with no requirements on how you do it. However, the instructions specifically say to concatenate the name to the end of the string. So I kind of feel like it shouldn't pass for not following the requirements.

When you use a variable inside a double quoted string, that's not considered concatenation is it?