Chris Rocco’s profile

Latest Comments


PHP does not strip out any newlines in your example. Your problem is that you are expecting:

echo 'TEST';

to output:


but it does not. You have to tell PHP that you want a newline there:

echo 'TEST\n';

Since you aren't telling PHP to put a newline at the end of the text you told it to output ("TEST"), it appends the next bit of text directly after the text you output via PHP... and makes you "feel" like PHP took a newline away - but it didn't.

Posted in PHP Stripping Newlines.

Tue, 27 Sep 2011 at 01:58:49 GMT


  • Twitter: @chrisrocco
  • Location: Los Angeles, CA
  • Joined: September 2011
  • Comments: 1