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.