Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chris Shiflett's Blog:
PHP Stripping Newlines
Oct 04, 2005 @ 10:34:50

In this new post on Chris Shilflett's blog today, he gives a situation that has frustrated several PHP developers out there who are a bit more finiky about how the resulting HTML turns out.

If you're picky about the format of your HTML like me, you've most likely noticed that PHP strips newlines that exist immediately after a closing PHP tag.

As PHP developers, most of us expect that anything not within a PHP block is left alone. After all, that's supposed to be the point of the opening and closing PHP tags. (This is the only exception of which I'm aware.)

There is an explanation offered here in the manual.

I'm the same way Chris is on a lot of my stuff. It bugs me that things are "pretty" in the resulting output, but I suppose there's always the the lazy way out...

tagged:

Link:


Trending Topics: