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

Walter Cortez
Walter Cortez
4,071 Points

Need help...thanks

<?php

//Place your code below this comment $firstName = 'Rasmus'; $lastName = ' Lerdorf';

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

index.php
<?php

//Place your code below this comment
$firstName = 'Rasmus';
$lastName = ' Lerdorf';

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

2 Answers

You almost have it. The first thing you need to look at is the extra space before the name Lerdorf. That extra space needs to be removed. Instead of ' Lerdorf' it should be just 'Lerdorf'

You then need to add a space between the $firstName and $lastName and also remove the quotes around them.

Your last line should look like this:

$fullname = $firstName.' '.$lastName;

Walter Cortez
Walter Cortez
4,071 Points

No...that's not working for me unfortunately.

Thank you

The code for the first two challenges should look like the following, It has been tested and passed.

<?php

//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';

$fullname = $firstName.' '.$lastName;
?>

You can run into problems with the last line, and it can be a bit tricky if you didn't add a space between $firstName and $lastName. For example" $fullname = $firstName(period)(single quote)(space)(single quote)(period)$lastName;