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 Escape Sequence

Escape sequence does not working ....

<?php

echo 'learning to print \'$name\' to the screen';
echo " \n learning to print \"$name\" to the screen \n ";

?>

my code is not printing on new line i m using atom text editor

Same here, i think that there is a bug with the n key as escapes it, but not acknowleding what n actually does.

1 Answer

What I have encounter when using \n at the start of my line and then running it back in terminal / console is that it doesn't create a new line above the statement. It actually creates a space before the statement. To visually see a new line in terminal / console I have had to do \n\n and that creates a new line.

Also, when running this statement and viewing it back in a web browser (if you have your local environment set up). The browser just shows it all in one long line.