When I first started writing PHP code, I wanted to write PHP closing tags. Later, I changed my habit and stopped writing PHP closing tags. I first came across this concept from Drupal, and I was a little uncomfortable at first - why not write a closing tag? This feels very imperfect, and very uncomfortable for people with obsessive-compulsive disorder! Later, I encountered problems caused by closing tags at work, so I started not writing closed tags.
For pure PHP files, the reason why closing tags are not written is to prevent extra spaces, tabs, etc. after the closing tags. These extra characters will be output when rendering the page, causing page misalignment; it is also possible, You include another PHP file in a PHP file and use the header function, and in the other PHP file, because there are extra characters after the closing tag, the final page will report an error because the output is done before the header function. . Therefore, it is strongly recommended not to write closing tags in pure PHP files.
This is also mentioned in Zend’s code specification: http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html