Resent due to lack of feedback.
----- Original Message -----
From: <[EMAIL PROTECTED]>
Newsgroups: php.dev
Sent: Wednesday, October 10, 2001 5:28 PM
Subject: heredoc: change of behavoiur?


> 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('[EMAIL PROTECTED]', 'heredoc test', <<<TEXT
> Hello Jeroen,
>
> Greets!
> TEXT, 'Cc: [EMAIL PROTECTED]');
> ?>
>
> 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.
>
>
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to