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 trialCRYSTAL MORRIS
Courses Plus Student 2,809 PointsI Am Concatenating To The Best Of My Ability.
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";
echo $lastname . "\n";
$fullName = "fullName";
echo "Mike " . $Mike; "the " . $the; "Frog " . $Frog;
echo "The designer at Shirts 4 Mike shirts is named ____";
?>
2 Answers
Stone Preston
42,016 Pointsthe values of the variables will be placed in the string where you put the variable name. for instance I could have some variables defined and concatenate them like so:
$hello = "Hello how";
$areYou = " are you?";
echo $hello . $areYou;
which would output Hello how are you?
also you only need a semicolon at the end of the statement, not after every variable name
CRYSTAL MORRIS
Courses Plus Student 2,809 PointsYour A Life Saver Today Mr. Preston, Thank You. :-)
Stone Preston
42,016 Pointsno problem : )