Re: POLL: To add the final ?> or not...

From: Date: Sun, 10 Jan 2010 16:57:09 +0000
Subject: Re: POLL: To add the final ?> or not...
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-300946@lists.php.net to get a copy of this message
On Sun, 2010-01-10 at 08:52 -0800, Jim Lucas wrote: > Stuart Dallas wrote: > > > > That's a massive assumption. There are a number of editors that automatically add a > > blank line to the end of source files. > > A single \n after the final ?> doesn't matter anyways. Even if the following > example was two different files where the second included the first, it would > still have the same results. > > Simple test: > > ########CONTENTS######## > <?php > > ?> > <?php > > echo (headers_sent() ? 'Yes' : 'No'); > > ?> > ########EOF######## > > No, as is, this will return 'No'. But if you place /ANY/ character between the > ?> > <?php > > including a newline, space, tab, etc... it will send the headers. > > So, basically saying that in this particular case ?><?php === ?>\n<?php > > With all that said, you CAN have a \n at the end of you file directly after the > ?>. But, you better make sure that nothing else is there along with it. > > Jim Lucas > > > > > -Stuart > > > Or if you're using a multibyte encoding in your file which isn't correctly interpretted... Thanks, Ash http://www.ashleysheridan.co.uk

« previous php.general (#300946) next »