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

From: Date: Sun, 10 Jan 2010 16:52:20 +0000
Subject: Re: POLL: To add the final ?> or not...
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-300945@lists.php.net to get a copy of this message
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 >

« previous php.general (#300945) next »