Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :)