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

PHP Build a Simple PHP Application Adding a Contact Form Concatentation

concatenate

im lost ive tried the periods between each variable but still cant pass this part here is the code

$firstName = "Mike"; $middleName = "the"; $lastName = "Frog"; $fullName = $firstName $middleName $lastName ;

4 Answers

When concatenating you need to add quotes around your variable followed by a period followed by empty quotes with a space in between acting as your space. I am fairly new to php and I believe this is how it should be. Give it a try and see if it helps if not let me know and I can see what I may have written down wrong.

$firstName = "Mike"; 
$middleName = "the"; 
$lastName = "Frog"; 
$fullName = "$firstName" . " " . "$middleName" . " " . "$lastName";

OK thanks you very much, i fixed it , only now im stuck again lol....im at the point where they asked us to concatenate an exclamation point at the end of the sentence. It shows up in preview but it still says that I coded it wrong.

here is how it looks

echo "The designer at Shirts 4 Mike shirts is named" . ' ' . "$fullName" . " " . "!" ;

In this case you don't need the extra space between the sentence and the !. They want it right after the name ex: " mike! ” I also noticed you used single quotes after the word named they need to be double quotes.

echo "The designer at Shirts 4 Mike shirts is named" . " " . "$fullName" . "!";

Thanks truly appreciate it !

Not a problem always happy to help. Don't forget to click the best Answear button next to my post. Helps me get more points :)