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 trialnicolabell
18,212 PointsWhat is wrong with my PHP strings?
I cannot work out what I am doing wrong here at all!
<?php
//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = $firstName . " " . $lastName;
$fullName .=" was the original creator of PHP." . "\n";
echo $fullName;
?>
1 Answer
andren
28,558 PointsThe issue is that in Task 2 you are asked to set $fullname
to $firstName $lastName
, in task 3 you change the contents of $fullname
by adding " was the original creator of PHP.\n" to it. This breaks task 2 because $fullname
now contains something besides just $firstName $lastName
.
In task 3 you are not supposed to change the $fullname
variable at all, you are just meant to use it as you echo out the sentence. Like this:
<?php
//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = $firstName . " " . $lastName;
echo "$fullName was the original creator of PHP.\n";
?>
nicolabell
18,212 PointsAh thanks! I think the way the question was phrased was a bit ambiguous but this worked :)
jessecarter
8,444 Pointsjessecarter
8,444 PointsI'm not totally sure what your question stated but have you tried this?