PHP PHP Basics Daily Exercise Program Escape Sequence

Escape sequence does not working ....


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

Dave Mora
Dave Mora
4,265 Points

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.