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.
The arguments in favor of omitting the tag look stronger (helps to avoid big headache with header() + it’s PHP/Zend “recommendation”). This isn’t the most “beautiful” solution in terms of syntax consistency, but I can’t find anything better.