Syntax error PHP syntax error, unexpected $end one of the causes and solutions

Source: Internet
Author: User
Tags parse error php syntax error
Parse error:syntax error, unexpected $end in script.php on line xx
After debugging for a while, found that the line that produced the error is a row in the middle of the file
$str. = ">\n";
Think of it. The end tag allowed by the PHP interpreter can also be annotated with a single line, i.e.//$str. = ">\n"; is interpreted as having a comment before the end tag, the content of the comment is//$str. = ", and \ n" After?>; will be interpreted as content outside of the PHP block as HTML output out! The result is to $str. = ">\n"; This line adds//comments, instead of a?> end tag, causing the original end tag to be unexpected (unexpected).
The solution is to simply delete the line.
PHP start and end tags in the line do not write anything else, is a good habit.

The above describes the syntax error PHP syntax error, unexpected $end error of a cause and resolution, including the content of syntax error, I hope that the PHP tutorial interested friends to help.

  • Related Article

    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.