This is the recommended usage in the official manual, which is described in detail in the manual:
If the file content is pure PHP code, it is best to remove the PHP end tag at the end of the file. This avoids having to accidentally add a space or line break after the PHP end tag, which causes PHP to start outputting these blanks, and there is no intention to output the script at this time.
Plain PHP files must omit the close tag,
A blank line must be at the end of the file.
Change as if it had to be LF.
This is the PSR-2 style guide, a guide that has been summed up after many open-source project style surveys, a method that most people use. Designed to switch between different PHP projects, or to review other people's code, can start seamlessly, reducing the cost of familiar styles. This style of all content is meaningful, such as omitting the close tag is mainly the file include and output content is not disturbed by the consideration. Otherwise, it is very likely that after your closing tag is doped into another file, inexperienced people will find it difficult to troubleshoot errors.
www.php-fig.org
I translate this two days, yii2 style, basically on the basis of PSR2 to make a few changes (indent four spaces to tab), https://github.com/AbrahamGreyson/yii2-zh-cn/blob/master/ Internals/core-code-style.md
Corrected, after intense discussion, Yii2 decided to fully compatible with PSR2, removing the tab indent and changing to a 4-space indent that better fits most of the community's habits.
A little off-topic, this is just a code style guide, the biggest meaning is not everyone to abide by it, but in a circle as far as possible to maintain consistency, in order to improve the efficiency of collaboration, at this point, Google has an article dedicated to the company's internal code specification of the need. We support and respect the basis of the guide is that, not so much personalization, everything in accordance with the custom of the Convention. There are quite a few major projects in PHP that are in full compliance with this style. For example Yii2 Symfony2 laravel. If you want to test the integration of style checks, you can install Php_codesniffer, he can be built when you check whether the style is in line with your settings.
Another comment is another category, and it is recommended that you use annotations that conform to the PHPDOC specification. You can automatically generate API manuals for your code, instead of class diagrams such as UML. Quick Query is convenient.
If you use a closed tag, any space behind a closed tag by a developer, user, or FTP application can cause extra output, PHP errors, output that cannot be displayed, and blank pages. Therefore, all PHP files should omit this PHP closed tag, and insert a note to indicate that this is the file's bottom and locate the file in the relative path of the application. This will help you to make sure that the document is over and not truncated.
Excerpt from CI Handbook
I have eaten a loss yesterday. When the file is require, it will send the superfluous things over.