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 PHP Basics Daily Exercise Program String Manipulation

Adam Smith
Adam Smith
4,611 Points

I am not able to add space between two php variables when combined into a third one.

Create a third string fullname. I'm stuck here. Googled for help. Did not manage to solve.

index.php
<?php

//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullname = $firstName " " $lastName;
?>
Oliver Bird
Oliver Bird
57,653 Points

You need to use the concatenation operator (the dot)

e.g.

$variableA . " " . $variableB;

1 Answer

You need to have periods to concatenate (glue together) strings.

$fullname = $firstName . " " . $lastName;

I hope this helps. ~Alex

Adam Smith
Adam Smith
4,611 Points

Never mind. I forgot the $ sign. Thanks.