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 trialDuncan Gilmour
1,563 PointsHow is my code not correct?
I am getting a Bummer response to my code input on this String manipulation test. I don't see what is wrong - and it comes out OK in the preview and in a browser.
<?php
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = "$firstName" ." " ."$lastName";
echo "$fullname was the original creator of PHP \n";
?>
2 Answers
filipepacheco
Full Stack JavaScript Techdegree Student 21,416 PointsYour code is right, just take off the space between PHP and \n. Instead of PHP \n, do PHP\n and it will work.
By the way, although it works, you don't need the quotation marks around the variables, if you are concatenating them. You can do:
$fullname = "$firstName $lastName";
or
$fullname = $firstName . " " . $lastName;
Duncan Gilmour
1,563 PointsThe question is in the title:
How is this code not correct? I can't get past the code checker yet it looks ok to me in the preview window and in independent browsers. Maybe it is not as elegant as you would like but it seems to work.
Konrad Pilch
2,435 PointsTry this line maybe.
$fullname = "$firstName" . "$lastName";
I mean what is the challenge question, not your obviously. I don't know what can be wrong with this if i don't know what they are asking for. But try the line above instead of the line you got.
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 PointsWhat's the question?