News Feed
Sections




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

Brian Moon's Blog:
The history of PHP eating newlines after the closing tag
March 04, 2009 @ 11:13:47

Brian Moon points out a (sometimes annoying) habit of PHP when it comes to newlines - it drops them after the closing tag.

Have you ever noticed that PHP eats the newlines after a closing PHP tag? Not sure what I mean? There is lots on Google about it. [...] So, why does PHP do this? Well, you have to go back 11 years. PHP 3 was emerging. I was just starting to use it for Phorum at the time. There were two reasons.

The first reason was the it, at least in the minds of the developers of the language, "removed all traces of PHP" from the script without any training newlines to show for it. The second case was a bit more valid - because lots of editors at the time required newlines at the end of every line of code. This caused loads of trouble tracking down things like the infamous "Headers already sent" issues (pre-output buffering).

0 comments voice your opinion now!
closing tag newline remove reason headers editor


blog comments powered by Disqus

Similar Posts

Community News: IBuildings techPortal's New Editor-in-Chief: Lorna Mitchell

Brandon Savage's Blog: Scaling Up: Baby Steps (a.k.a. Asking The Right Questions)

NetBeans Blog: PHPUnit support added

Tim Koschuetzki's Blog: Composing Methods: Remove Assignments to Parameters

Rob Allen's Blog: Sublime Text 2 Snippet for PHP getter and setter generation


Community Events





Don't see your event here?
Let us know!


framework api list tips series podcast library laravel symfony interview language community opinion voicesoftheelephpant deployment bugfix introduction install package release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework