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 trialVidit Shah
6,037 Pointswhats wrong in php code
$fullName=$firstName. $middleName. $lastName;
<?php
$firstName = "Mike";
$middleName = "the";
$lastName="Frog";
$fullName="";
$fullName=$firstName. $middleName. $lastName;
echo "The designer at Shirts 4 Mike shirts is named ____";
?>
2 Answers
Shaun Dixon
10,944 PointsThe issue you have is that you have not assigned the variable $fullName the variables $firstName, $middleName and $lastName.
You need to use PHP concatenation to do this which can be achieved by:
<?php
$firstName = "Mike";
$middleName = "the";
$lastName="Frog";
$fullName = $firstName . " " . $middleName . " " . $lastName;
The " " is what you would use between each variable to put a space between the names, so it would be equal to Mike the Frog.
Ted Sumner
Courses Plus Student 17,967 PointsShaun is correct. In addition, you will not see what happens until you add the variable to the echo string using the same concatination format.