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

Christhoper Key
PLUS
Christhoper Key
Courses Plus Student 2,061 Points

Im getting right result of a task but its keeps saying that $fullName is not using $lastName! I have set 2 varia

Im getting this alarm becous there is better way to display third variable of $fullName?

index.php
<?php

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

$fullName = "$firstName" .
            " ".
            "$lastName";

echo $fullName;

?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Something about that is confusing the challenge, but there's nothing technically wrong with it from what I can tell. If I move everything onto the same line (without actually changing the code), it works. That being said, you are over-complicating things here a bit with some unnecessary concatenation. Also, the challenge does not ask for you to echo the results at this time. The same thing could be accomplished with:

$fullName = "$fullName $lastName";

Remember, using double quotes causes the values of the variables to be expanded in place.

Hope this helps! :sparkles: