4 ms·
There is a good reason to not include the closing tag. Silly people can add newlines after the ?>. That leads to random newlines in your output which are anno
by thelarry 14y ago
There is a good reason to not include the closing tag. Silly people can add newlines after the ?>. That leads to random newlines in your output which are annoying to track down.
- Too 14y agotrivia - PHPStorm's code-inspectior reports closing php-tag at end of file as code smell.
- contingencies 14y ago<sarcasm>Oh my god thank you for your enlightened teachings I understand completely now.</sarcasm> What is the effect of the additional text in the file with the closing tag? They are output, and visible. What is the effect of the additional text in the file without the closing tag? It is interpreted as code, becoming a potential security issue. Are they difficult to track down because your development process sucks, or because there's something illogical and mystical going on? (Hint: There's nothing illogical and mystical going on) Using continuous integration (an RCS/VCS-linked automated testing scheme) you can trivially determine which change broke which part of a system. In fact, you don't have to, because the system will tell you. If you are worried specifically about accidental newlines at the end of a file, you can just write a rule in ~project/.git/hooks/pre-commit (or similar on a server) that rejects checkins that don't match that style. Going around telling the whole world to adopt some ridiculous habit because your development process is out of the stone age is a reflection on that process only.