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 trial

PHP PHP Basics Daily Exercise Program String Manipulation

I am struggling with Displaying and adding a line break to my final string.

I am trying to display $fullName and add a line break to it as well. I am also confused as to if they want me to include, "Rasmus Lerdorf was the original creator of PHP." Or if that is just part of the example.

index.php
<?php

//Place your code below this comment
$firstName = 'Rasmus';
$lastName = 'Lerdorf';
$fullname = $firstName . " " . $lastName;
echo = $lastName\n;
?>

3 Answers

Julian Gutierrez
Julian Gutierrez
19,201 Points

Yes you are needing to echo out the full string "Rasmus Lerdorf was the original creator of PHP" by concatenating $fullname with "was the original creator of PHP".

Thank you, Julian, for the response, I went back in and gave it a try. I am just struggling with this, if it is not too much trouble could you write it out for me. I'm just picking this stuff up better when I see it applied to something specific so its hard for me to go from the video to the quiz. Thank you!

Julian Gutierrez
Julian Gutierrez
19,201 Points

You really are very close the final line is where you are running into some trouble.

For starters, echo doesn't need an assignment operator. Now we already have the string "Rasmus Lerdorf" in our $fullname variable so to create the final string output we need to add or concatenate $fullname with the rest of the string followed by your line break.

<?php

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

$fullname = $firstName . " " . $lastName;

echo $fullname . " was the original creator of PHP\n";
?>

Thank you so much, Julian! This was very helpful. When I went back in I did include the operator in echo and I thought that I needed to create a space between $fullname and was the original creator of PHP so I had it written

'''echo = $fullname . " " . 'was the original creator of PHP\n"

Thank you again!