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

Problem rendering in code challenge?

I can't get past a particular code challenge in PHP basics, but I think something is rendering incorrectly. When I paste the exact same code into my workspace, I get a new line at the end. However, in the code challenge it creates a space, not a line. Code below. Am I missing something obvious or is it ignoring the new line?

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

Even adding a "test" string at the end gets different results.

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

yields the following in workspace: Rasmus Lerdorf was the original creator of PHP

test

yet yields the following in code challenge: Rasmus Lerdorf was the original creator of PHP test

2 Answers

Alena Holligan
STAFF
Alena Holligan
Treehouse Teacher

If you are running the code in the workspace console, it is plain text, so the \n translates as a new line break. The preview on the code challenge is html so \n doesn't show as a line break unless you were to look at the source. However, your code should work for the code challenge.

Thanks, the clarification is much appreciated!