Just out of curiosity, I decided to ask this question. In some very well-known CMS, it is customary not to close the
It looks like this.
I read a long time ago that this is related to the security of the application, and that, supposedly, if someone forgets something there, the consequences are terrible. But to be honest, this approach annoys me a little. Because opening and closing is the first thing I do before I get lost in thought. If someone can reasonably explain why this perversion is really needed, I will be grateful.
Answer 1, authority 100%
For example, in Zend Frameworkthis is explained as follows:
For files containing only PHP code, the closing tag (“?>”) is not allowed. It is not required by PHP syntax and omission prevents trailing spaces from being accidentally included in the output.
In my opinion, this is a good practice, it is easier not to put a closing tag at all than to make sure that a space character is not lost after it.
Answer 2, authority 50%
The biggest problem is probably the extra space after the ?>
Because then you won’t be able to, for example, use
In general, frankly speaking, there is nothing so terrible in closing…
By the way, what’s wrong? If you write OOP code, then you don’t care whether to close it or not 🙂
If not, then yes, then don’t bother and close yourself to your health;)
Answer 3, authority 50%
I always close, always clean up the spaces after and before (more precisely, the IDE does this for me).
I consider it perverted not to close it, as it breaks the template of my XML perception of the document.
For example, to avoid parse error. I myself never close