The concept was first approached from Drupal, and at first it was a bit of a habit-why not write a closed tag? This feeling is not perfect, for people with obsessive-compulsive disorder is very not adapt to it! Later, in the work encountered because of the closure of the problem caused by the label, began not to write closed tags.
See a few articles, the summary of the PHP closed tag is as follows:
Benefits: If this is a program that is included by others, without this terminator, you can reduce a lot of problems, such as: header, Setcookie, session_start These actions can not have output before, if not careful in?> After adding invisible characters (extra space, line break) and other damage page display, will report "Header already sent" error, do not write words will not have this problem. Alternatively, you can move the cursor directly to the end and then program.
Cons: in the Dreamweaver view mode, a mess.
The official explanation for the PHP closed tag is that the PHP closed tag "?>" is optional for PHP parsers in PHP. However, if you use a closed tag, any space that is inserted by the developer, user, or FTP application after the closing tag may cause excess output, PHP errors, subsequent output that cannot be displayed, and blank pages. Therefore, all PHP files should omit this PHP closing tag and insert a note to indicate that this is the bottom of the file and locate the relative path of the file in this application. This will help you to make sure that the document is over and not truncated.
This is also mentioned in the Code specification for Zend: http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html
code example:
Improper:
Copy Code code as follows:
<?php
echo "Here's my code!";
?>
appropriate to:
Copy Code code as follows:
<?php
echo "Here's my code!";
/* End of File myfile.php * *
/* Location:./system/modules/mymodule/myfile.php * *
Therefore, if it is a pure PHP code file, you should omit the?> end identifier.