That's what this whole conversation is about. Someone linked to
a post by "jon@php.net", whoever he is, who said it doesn't matter if the closing tag is there or not. Seems sort of shaky to me, and doesn't stop the situation where there are spaces at the front, but I guess that happens less. The real answer is that people have to be careful what they do with source.
On Fri, 21 Jul 2006, Mark Edwards wrote:
On Jul 21, 2006, at 1:28 PM, Martin Marques wrote:
On Fri, 21 Jul 2006, Eric Stadtherr wrote:
I like the idea of leaving off the "?>" in included files, but we should be careful to leave it in place for "standalone" php files (i.e. those that can be the target of a URL requested by a client). Is that only the "index.php" file for this application?
I'm lost. Where are the standalone php files? AFAIK everything is requested via apache (or your favorite web server).
Standalone, as in not included by another file. At some point the data has to have a closing ?> or it isn't valid PHP. I guess it is legal (?) to not have a ?> at the end of included files, or at least that it works, but I'm pretty sure at some point the data has to be closed with ?> or there will be errors thrown.
A PHP file starts with <?PHP and ends with ?> or its not a PHP file. Right?
-- Mark Edwards