PHP syntax error, unexpected $end a cause of errors and _php skills

Source: Internet
Author: User
Tags parse error php syntax error
Parse error:syntax error, unexpected $end in script.php at line xx
After debugging for a while, you find that the row that generated the error is a row in the middle of the file

$str. = ">\n";

I remember. The end tag allowed by the PHP interpreter the line can also be in a single comment, i.e.//$str. = ">\n"; is interpreted as a note before the end tag, and the content of the comment is//$str. = ", and?> behind \ n"; will be interpreted as the contents of the PHP block outside the HTML output! The result is to $str. = ">\n"; This line adds//becomes a comment, instead of a?> end tag, causing the original real end tag to be unexpected (unexpected).
The solution is to simply delete the line.

PHP start and end tag rows don't write anything else, it's a good habit.

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.