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

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

 



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
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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