Php tag <? Php?> Is it necessary to add the end tag in

Source: Internet
Author: User
Remember that my tutor told us the php end tag during the training period? & Amp; gt; you can choose not to add it, and it is best not to add it. In some cases, it is necessary (forget what the situation is). What do you think of Daniel? [Ps: of course, in the case of a mix of php and html, it must be completed... remember that during the training, the instructor told us the php end tag?> You can not add it, and it is best not to add it. In some cases, it is necessary to forget the situation)
What do you think?
[Ps: Of course, the end tag must be added when php and html are mixed]

Reply content:

Remember that my tutor told us the php end tag during the training period?> You can not add it, and it is best not to add it. In some cases, it is necessary to forget the situation)
What do you think?
[Ps: Of course, the end tag must be added when php and html are mixed]

HTTP: http://segmentfault.com/q/1010000000437998#a-1020000000438006

Http://www.php.net/manual/zh/language.basic-syntax.phptags.php

If the file content is pure PHP code, it is best to delete the PHP end mark at the end of the file. This avoids accidental addition of spaces or line breaks after the PHP end mark, which may cause PHP to start to output these spaces, but the script does not have the intention to output at this time.

To remove the end tag of php, you must first ensure that all your scripts are written in php and get a definite answer, I think it is my habit to delete the end tag or not.
In general, many programmers will not add this, because the benefits of doing so can avoid many inexplicable errors during code compilation, and you should remove them?> But you don't know why...
This is also my habit. I hope it will help you.

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.