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

Remove the four underscores in the echo command and concatenate the remaining text with the variable $fullName.

<?php

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

echo "The designer at Shirts 4 Mike shirts is named" . " " . $fullName ; $fullName = $firstName . " " .$middleName . " " .$lastName;

?> this is what i got. what am i doing wrong?

2 Answers

Keith Kelly
Keith Kelly
21,326 Points

You are pretty close with your answer there are a couple issues that you would need to address.

  1. Establish the fullName variable prior to the echo command
  2. After named you don't need to concatenate the space. You can simply add a space after the named before the quotes.

The code would look something like this:

<?php

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

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

?>

Hope that helps!

Calvin Williams
Calvin Williams
2,174 Points

This is it.

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


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

?>