Why PHP files do not write closed tag conventions

Source: Internet
Author: User
Tags drupal
When I first started writing PHP code, I was about to write PHP closed labels. I used to change it later and didn't write PHP closed labels anymore. This concept was first introduced from Drupal. at the beginning, I was a little unaccustomed to writing PHP code. When I first started writing PHP code, I wanted to write PHP closed labels, and then I used to change it, PHP closed labels are no longer written. This concept was first introduced in Drupal and was a bit unaccustomed at the beginning-why not write a closed tag? This is not perfect. it is not suitable for people with obsessive-compulsive disorder! Later, I encountered a problem caused by Tag closure in my work, so I started not to write the closed tag.

For PHP files, the reason for not writing closed labels is to prevent redundant spaces and tabs after the closed labels. these extra characters will be output during page rendering, resulting in page dislocation; it is also possible that you include another php file in a php file and use the header function. in Another PHP file, the closed tag contains additional characters, in this case, an error is reported because the output is performed before the header function. Therefore, we strongly recommend that you do not write close tags in 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.