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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux