When I started writing PHP code, I was going to write PHP closed tags, after a few years, habits changed, no longer write PHP tags.
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 you accidentally add an invisible character behind?> (extra space , line breaks, and so on, will be reported "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.htmlcode example: Improper: code is as follows: <?php echo "Here's my code!"; ?> appropriate: 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?> ending identity Character.