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 trialVjacheslav Rozman
1,895 PointsHaving trouble with passing "Combining strings" objective.
I am having trouble with passing "Combining strings" third objective.
-There is the task which makes me mad :D
1) Use the $fullName variable to display the following string to the screen. Rasmus Lerdorf was the original creator of PHP
2) Use an escape character to add a newline to the end of the string.
-There is on of my solutions (This one is in my opinion the closest one to the right solution).
<?php
//Place your code below this comment
------> These two are pre-tasks
//task 1
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
//task 2
$fullName = "$firstName $lastName";
------> This one is the one I have trouble with
//task 3
$task3 = "$fullName was the original creator of PHP /n";
echo $task3;
?>
I already can see that I made stupid mistake and I will look like an idiot :D but despite trying really hard and watching video about combining strings like three or four times I still cannot put together the right solution.
The result is that I cannot progress to next steps and also I am slowly but surely getting bored about all this thing.. :(
I hope you will save me.
Thank you for all the answers I will get mates.)
4 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsTry something like this:
<?php
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = "$firstName $lastName";
echo "$fullName was the original creator of PHP\n";
?>
Komang bagus suardi
3,396 PointsTask 2
//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullName .= "$firstName $lastName";
?>```
Christopher Beckett
1,289 PointsHi I need help with question 3. I passed the first 2 easily but I can't get my head around the 3rd one. I need it done ASAP as on a time frame.
<?php
//Place your code below this comment
$firstName ='Rasmus'; $lastName ='Lerdorf'; $fullName = "$firstName $lastName";
echo $firstName; echo $lastName; echo $fullName;
echo ?>
here's my code I tried doing it my self and watching the video just cant figure it out but I tried all different ways including what has already been said here but nothing is working please can you help thanks in advance
Vjacheslav Rozman
1,895 PointsYes, it seems like the best way to learn, thank you for your time:)
Vjacheslav Rozman
1,895 PointsVjacheslav Rozman
1,895 PointsThanks, you helped me a lot.
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsIn case this didn't make a lot of sense, I would recommend maybe watch the video 1 more time :-)
Normal I watch the videos while following a long in workspace the first time, and after some time I will go back and watch the videos again (without workspace) to see if I missed some details or to see if it made more sense the second time :-)