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 trialMUZ140770 Selestino Gama
4,980 PointsCreate a variable called fullName and assign it a value equal to the concatenation of the firstName variable, a space, t
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.
<?php
$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullname =
echo "The designer at Shirts 4 Mike shirts is named ____";
?>
2 Answers
Chris Shaw
26,676 PointsConcatenating strings in PHP is pretty simple, all it requires is for us to use a period and in the case of this challenge, two spaces joining three variables. For the challenge all we really need to do is use . ' ' .
twice, once between $firstName
and $middleName
, and again between $middleName
and $lastName
.
See the below.
$fullName = $firstName . ' ' . $middleName . ' ' . $lastName;
Happy coding!
MUZ140770 Selestino Gama
4,980 Pointsthanks it worked
mikes02
Courses Plus Student 16,968 PointsHi Selestino,
Glad to hear that Chris Upjohn's answer worked. On the forums, when an answer solves your issue it is great for you to mark it as the Best Answer. This rewards the person who answered with some bonus points and also lets other forum members, who may be facing the same or similar issue, know that this thread has an approved answer. I've marked it for you this time around, but just something to keep in mind moving forward.