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 trialAli Corlett
Courses Plus Student 1,359 Pointsvariable strings in php not showing how test wants to see it.
Hi Konrad, thanks I added the missing . between the string and variable for $lastName,but the test whilst it resolves the query in returns with an error which I have included in the final //comment setion in the code. Can you help me please? Ali
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
//The Test question is:
//create a third string named 'fullname' and use the $firstName and $lastName variable
$fullname = 'First Name' . $firstName . 'Last Name' . $lastName;
echo $fullname;
//error message says... $fullname does not seem to use $firstName and $lastName
?>
3 Answers
jacobproffer
24,604 PointsHey Ali,
Refactor the fullname variable. The value returned should be Rasmus Lerdorf. To do this, concatenate the firstName and lastName variables but in between, concatenate a space.
Like so:
<?php
$fullname = $firstName . " " . $lastName;
?>
You are then required to echo out a sentence that reads, "Rasmus Lerdorf was the original creator of PHP," followed by a newline character. This will also require concatenation.
<?php
echo $fullname . " was the original creator of PHP\n";
?>
Brett Marion
6,915 PointsHello Ali,
Have you tried the following code for your $fullname variable
$fullname = $firstName . " " . $lastName;
Ali Corlett
Courses Plus Student 1,359 PointsThanks Brett, It has solved the issue. Ali
Ali Corlett
Courses Plus Student 1,359 PointsThanks Jacob - really appreciate it. will try this out now. Ali