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 trialJuliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsTask 3 concatenation
Hi,
I have managed to get through the first two tasks of stage 3, but my code is not working.
What could be wrong?
Thanks!
<?php
$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullName = $firstName."".$middleName."".$lastName;
echo "The designer at Shirts 4 Mike shirts is named."".$fullName;
?>
3 Answers
MUZ140348 Kudakwashe Mugoniwa
6,538 Points<?php
$firstName = "Mike"; $middleName = "the"; $lastName = "Frog"; $fullName = $firstName." ".$middleName." ".$lastName;
echo "The designer at Shirts 4 Mike shirts is named" ." " .$fullName;
?>
Robert Richey
Courses Plus Student 16,352 PointsHi Juliette,
That's a great attempt! There are two issues I can see.
- fullName needs to contain the concatenated names with spaces between each
- the line being echo'd needs a space between the string and the fullName. This can be accomplished without concatenating an actual space by instead leaving a space at the end of the string.
Hope this helps!
Cheers
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsThanks Robert, but that is what I thought that I had done. It seems so simple, but I am still confused.
Maybe I should come back to this tomorrow with a fresh brain:-)
Robert Richey
Courses Plus Student 16,352 PointsBreaks are good :) If you continue having issues tomorrow, just post in this thread and I'll be here to offer more thorough help.
MUZ140348 Kudakwashe Mugoniwa
6,538 PointsMUZ140348 Kudakwashe Mugoniwa
6,538 Pointsecho "The Designer at Shirts 4 Mike is named:". " ".$fullName;
when concatenating you first to place the text in quotes like "put your text here" after the text use the concatenation (.) dot followed by a space in quotes again(so that there is space between your first string the other string/text) then after the space you add dot for concatenation with the variable $fullName (variable will not be in quotes) echo "string/text to be displayed"."space in quotes".$variable name;
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsJuliette Tworsey
Front End Web Development Techdegree Graduate 32,425 PointsThank you! I was missing a quotation mark after named.
..so simple...so complex...:-)