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 trialTim Long
111 PointsI am stuck on Build a Simple PHP Application Challenge Task 2 of 4
I am stuck?
<?php
$fullName . "Mike";
$middleName = "the";
$lastName ="Frog";
$fullName = . $fullName . $middleName . $lastName;
echo $fullName;
?>
4 Answers
. Ali
9,799 PointsHi Tim,
Try this,
<?php
$fullName . "Mike";
$middleName = "the";
$lastName ="Frog";
$fullName = $fullName . " ". $middleName . " ". $lastName;
echo $fullName;
?>
You can also do as follow ;
<?php
$fullName . "Mike";
$middleName = "the";
$lastName ="Frog";
$fullName = $fullName ," ", $middleName, " ",$lastName;
echo $fullName;
?>
comma or dot i.e. (. or ,) serve the same purpose of concatenation. But if you don't include a space then the out put will be as follow, firstnameMiddleNameLastName However by including the space you get firstName middleName lastName
hope that helps and do rate the answer if it is acceptable. cheers and all the best
Tim Long
111 PointsOk I will thanks Tim
Tim Long
111 Pointsyes this worked
<?php
$firstName = "Mike"; $middleName = "the"; $lastName = "Frog"; $fullName = $firstName . " ". $middleName . " ". $lastName;
echo $fullName; ?>
Tim Long
111 PointsRemove the four underscores in the echo command and concatenate the remaining text with the variable $fullName.
<?php
$firstName = "Mike"; $middleName = "the"; $lastName = "Frog"; $fullName = $firstName . " ". $middleName . " ". $lastName;
echo $fullName; ?>