Many times phpnowdocHereDoc is used to insert a large number of Hmtl, but it prompts a syntax error. In fact, the PHP manual indicates that the script is written in this way. it is really strange that the problem was found at the end, at the end of such a document, it must be near the first line, that is to say, there must be no space before the EOF, and for code indentation, this problem occurs.
The code is as follows:
$ Str = <'eod'
Example of string
Spanning multiple lines
Using nowdoc syntax.
EOD; // The EOD must be near the front, and there must be no spaces. do not miss the end character semicolon;
Appendix: differences between heredoc and nowdoc
Heredoc uses the <EOT identifier, while nowdoc uses the <'eot' identifier. nowdoc is a new technology introduced in PHP5.3 and contains the heredoc syntax, however, the content will never be converted or interpreted. what is the content and PHP-related content will not be parsed.
We recommend that you enclose the PHP variable {$ name-> change ()} in brackets in heredoc to avoid ambiguity. if you want to output the variable as is, you can use the legendary escape character \, escape characters can be output using escape characters, that is, the \ representation method. escape output is required for all the braces.
To ensure availability, we recommend that you use the heredoc syntax, which is also escaped. because the nowdoc syntax introduced by PHP5.3, it is very likely that it is not supported by the multi-cloud hosting environment, resulting in a break.
At last, heredoc was introduced from PHP4.0, while nowdoc requires version 5.3. because heredoc contains the nowdoc function, it is recommended that heredoc be used.
To put it simply:
1. heredoc is dynamic and nowdoc is static.
2. heredoc is similar to the double quotation marks of multiple rows. newdoc is similar to the single quotation marks of multiple rows.
3. heredoc is a general solution dedicated to processing large string segments, while nowdoc is a static version of php that achieves "high efficiency" to make up for the dynamic implementation of the "heredoc" efficiency problem.