Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Daily Exercise Program Combining Strings

Having 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.)

3 Answers

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,319 Points

Try something like this:

<?php

$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullName = "$firstName $lastName";

echo "$fullName was the original creator of PHP\n";

?>

Thanks, you helped me a lot.

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,319 Points

In 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 :-)

Task 2

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

$fullName .= "$firstName $lastName";
?>```

Yes, it seems like the best way to learn, thank you for your time:)