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

Justin Armstrong
Justin Armstrong
3,702 Points

php concatenation task 2 of 3

I don't understand the part about the spaces, what do I need to do?

index.php
<?php

//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf" ;
$fullName = $firstName . $lastName ;

?>

2 Answers

jamesjones21
jamesjones21
9,260 Points

sure I can: example

$fullName = $firstName . ' Space is in here  between single or double inverted commas ' . $lastName ;

how it should look

$fullName = $firstName .  '  ' .  $lastName ;
jamesjones21
jamesjones21
9,260 Points

To add a space to a concatenated string you just add . ' ' .

So where the firstname and last name is just add the above between it, so it will be a single quote space and single quote. This will then create the space between the variables.

Justin Armstrong
Justin Armstrong
3,702 Points

Can you please show me an example because I am still having trouble understanding what you mean?