Just my two cents about this debate. To summarize :
Always keep the closing PHP tag “?>” for files containing only PHP ?
- Would be logical to close any opened tag, like with other languages. Not only X(HT)ML tags, but as well curly braces, brackets…
- Less confusing for beginners.
- Avoids headache with adding inadvertently whitespaces after the closing tag, because it breaks the header() function behavior… Some editors or FTP clients / servers are also known to change automatically the end of files (at least, it’s their default configuration)
- PHP manual says closing tag is optional, and Zend even forbids it.
I would say that the arguments in favor of omitting the tag look stronger (helps to avoid big headache with header() + it’s PHP/Zend “recommendation”). I admit that this isn’t the most “beautiful” solution I’ve ever seen in terms of syntax consistency, but what could be better ?