About the PHP finished tag?> Usage details

Source: Internet
Author: User
About the PHP end tag? & Gt; usage details author: zhanhailiang date: When PHP parses a file, it will look for Start & lt ;? Php and end mark? & Gt; indicates that PHP starts and stops interpreting the code. This method of parsing can embed PHP into a variety of different documents. any content other than a pair of start and end tags will be related to the PHP end tag?> Usage details
Author: zhanhailiang date:

When PHP parses a file, it looks To tell PHP to start and stop interpreting the code.This method can embed PHP into different documents. any content beyond the start and end tags will be ignored by the PHP parser. In most cases, PHP is embedded in HTML documents.

A single-line comment is only commented to the end of the line or the current PHP code block, depending on which one appears first.This means in //...?> Or #...?> The subsequent HTML code will be displayed:?> The PHP mode is jumped out and the HTML mode is returned. // or # does not affect this.

From the above discussion, we can see that,Even if?> In the // annotation, the PHP parser will also think that the PHP parsing is over(When PHP encounters an end Mark?> Then, it simply outputs the original content (unless it is followed by a new line, see the instruction separator) until the next start mark is reached ).

 ?>|', $a, $b);//print_r($b);

Output:

:!php preg.php|', $a, $b);//print_r($b);

How can I fix the above problems? Or you can use/**/for comments, or set?> Connect with a string connector, as shown below:

 ?'.'>|', $a, $b);print_r($b);

This details also applyJS end tag script

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.