ID: 40283 Updated by: [EMAIL PROTECTED] Reported By: hugorumens at yahoo dot com Status: Open Bug Type: Documentation problem Operating System: WinXP PHP Version: Irrelevant New Comment:
The ; is NOT absolutely necessary. Here is a contrived example of when not ... <?php $s_Text = <<<END_TEXT This is a line of text. END_TEXT . <<<MORE_TEXT This is more text. MORE_TEXT; echo $s_Text; ?> Produced output of ... This is a line of text. This is more text. The only criteria is that the closing tag must be left aligned. Previous Comments: ------------------------------------------------------------------------ [2007-01-30 09:25:17] hugorumens at yahoo dot com Description: ------------ Regarding this page: http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc The first sentence reads: "Another way to delimit strings is by using heredoc syntax ("<<<"). One should provide an identifier after <<<, then the string, and then the same identifier to close the quotation." Surely this should read, for example: "...One should provide an identifier after <<<, followed by a newline character, then the string..." The same situation as described for the closing identifier is needed for the opening, that of a newline char, else a parse error occurs. This is not clear in the docs as is. Secondly: Are the references to "except possibly a semicolon (;)" correct? A semicolon is absolutely needed after the closing identifier to avoid a parse error. Thanks. Reproduce code: --------------- <?php $somevar = <<<ABC This is my string that HAS to start on this newline. If the word 'This' was on the same line as the ABC identifier, I'd get a parse error. The semicolon after my closing identifier is absolutely needed. ABC; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40283&edit=1
