Re: Consider only ignoring newlines for final ?> in a file
| From: | Christoph M. Becker | Date: | Thu, 07 Sep 2017 14:38:57 +0000 |
| Subject: | Re: Consider only ignoring newlines for final ?> in a file | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100447@lists.php.net to get a copy of this message | ||
On 07.09.2017 at 16:21, Andrea Faulds wrote:
> This seems like a reasonable workaround, thank you for the idea. It
> reminds me of what PHP's source code does with preprocessor instructions:
>
> #ifndef FOO
> # define FOO
> #endif
Hence the name PHP. :)
> That said, I still think the ?> newline behaviour should be looked at,
> since this kind of workaround isn't universally applicable (and in any
> case isn't to everyone's tastes). In particular, if you want to generate
> plain text and need to insert a newline, having PHP throw them away and
> requiring you to add extra ones to compensate makes for uglier source
> code which is harder to reason about.
If you don't mind a trailing space (I don't like them, but well), you
can write:
<?='foo'?>
bar
And of course, there are template engines which could be used as well.
Frankly, I don't see any need for action here. :)
--
Christoph M. Becker