heredoc: change of behavoiur?

From: Date: Wed, 10 Oct 2001 15:28:13 +0000
Subject: heredoc: change of behavoiur?
Groups: php.dev 
Request: Send a blank email to php-dev+get-67694@lists.php.net to get a copy of this message
Currently, heredoc as a bit of strange behaviour in syntax of terminating it. I think it's a good idea to be a bit looser. It will make it more consistent, and allows inline use of heredoc. For BC: I really think that's no problem, but in rare cases it could lead to problems. I don't know yet wether BC alone would be showstopper for this patch. On the way this patch also solves the bug that mac-newlines are not understood (didn't see a bug report yet, but that's probably because not much people use the mac...) if there are other reasons to hold to the current syntax, please let me know. (see also: bug 13610) Patch available here: http://www.A-Eskwadraat.nl/~jeroen/php/looser_heredoc.diff which changes behaviour to: A heredoc is considered closed when the heredoc identifier appears directly after a newline. Remaining characters are allowed, provided they are invalid identifyer characters. Example: <?php mail('jeroen@php.net', 'heredoc test', <<<TEXT Hello Jeroen, Greets! TEXT, 'Cc: bla@example.com'); ?> And this works: <?php echo <<<HEREDOC bla HEREDOCUMENTATION; HEREDOC; // here the heredoc ends ?> But this doesn't: <?php echo <<<HEREDOC bla HEREDOC UMENTATION; HEREDOC; ?> for the same reason as this is: echo "bla" UMENTATION; causes a parse error.

« previous php.dev (#67694) next »