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

Problem - Use of escape charatcer to add new line to the end of the string

Somehow it shows error after "checking work" but in text editor with exactly the same code it adds a new line at the end of the string when I display it

Rasmus Lerdorf was the original creator of PHP.
treehouse:~/workspace$

Am I missing something?

Thx in advance

index.php
<?php

//Place your code below this comment
$firstName = "Rasmus";
$lastName = "Lerdorf";
$fullname = $firstName . ' ' .  $lastName;
$fullname = $fullname . ' was the original creator of PHP.';
$fullname = $fullname . "\n";
echo $fullname;
?>

2 Answers

Daniel Stopka
Daniel Stopka
13,520 Points

Hi Santis,

two main things: the third challenge is asking to display the sentence, so you should use echo, instead of creating a string in variable... You have also changed the content of $fullname, there should be firstname and lastname only. If you change the variable, then the second tasks of challenge is no longer correct...

Second thing is small typo, there is no dot 'was the original creator of PHP' at the end of the sentence...

Bye

Hi Daniel! I guess I need to pay more attention to what's written in tasks and not trying to figure out something special and complicated where everything should be simple. Thx ..i was able to solve the challenge.

Daniel Stopka
Daniel Stopka
13,520 Points

Good to hear :) and I also overthink some things sometimes...