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 trial
Leon Kenedy
Courses Plus Student 9,149 PointsCould you please help me with this code challenge?
I need help with problem two.
http://teamtreehouse.com/library/build-a-simple-php-application/adding-a-contact-form/concatentation
Leon Kenedy
Courses Plus Student 9,149 Points<?php
$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullName = $fullName . $firstName;
$fullName = $fullName . $middleName;
$fullName = $fullName . $lastName;
echo "The designer at Shirts 4 Mike shirts is named ____";
?>
Hugo Paz
15,622 PointsNearly there Leon,
What you've wrote echos this:
MikeTheFrog
Remember that you need a space in between the words.
2 Answers
Ken Alger
Treehouse TeacherLeon;
To concatenate strings with spaces in between in PHP you would use the following syntax:
$foo = "foo";
$bar = "bar";
$baz = $foo . " " . $bar;
Now if you do an echo $baz; statement you will get "foo bar". If you don't include that concatenated space you would get "foobar".
Happy coding,
Ken
mikes02
Courses Plus Student 16,968 Points<?php
$firstName = "Mike";
$middleName = "the";
$lastName = "Frog";
$fullName = $firstName.' '.$middleName.' '.$lastName;
echo "The designer at Shirts 4 Mike shirts is named $fullName";
?>
Hugo Paz
15,622 PointsHugo Paz
15,622 PointsHi Leon,
Could you please post what you have tried so far?