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

Concatenation Challenge question #3
echo "The designer at Shirts 4 Mike shirts is named . $fullName";
What is wrong with this concatenation of text and the variable I created?
6 Answers

I think your quotation marks only need to be around the text eg: "The designer at Shirts 4 Mike shirts is named" . $fullName;

James Barnett
39,199 PointsInside double quotes you don't need concatenation.
echo "The designer at Shirts 4 Mike shirts is named $fullName";
If you want to make your life hard you can do:
echo "The designer at Shirts 4 Mike shirts is named" . $fullName;
See for yourself, with this micro-demo I made for you

Thank you James. That was very helpful. I dont recall that point being made in the video.

Randy Hoyt
Treehouse Guest TeacherHey @Jason,
I just covered that second form in the video. (I haven't explained the difference between using single quotes and double quotes around pieces of text yet, so I wanted to use a syntax that would work with both of them. :-)
I trust you were able to get through the code challenge?

Joshua Russo
10,037 PointsI can't get it. I've done almost every combo I could think of.
. <pre><?php
$firstName = "Mike"; $middleName = "the"; $lastName = "Frog"; $fullName = ""; $fullName = $fullName . $firstName . " "; $fullName = $fullName . $middleName . " "; $fullName = $fullName . $lastName;
echo "The designer at Shirts 4 Mike shirts is named $fullName";
?></pre>

Randy Hoyt
Treehouse Guest TeacherHmmm ... I think it is not recognizing the
. I think it should work if you just press the spacebar to type a plain space:
$fullName = $fullName . $firstName . " ";
$fullName = $fullName . $middleName . " ";
$fullName = $fullName . $lastName;
Does that help?

Joshua Russo
10,037 PointsYes, that worked! I tried everything I could think of. I even did .' '; But I guess I needed double quotes not single. Sheesh! Thanks so much!

James Barnett
39,199 PointsThe important lesson here is that double quotes work with variable replacement whereas single quotes treat all characters as literals.