Re: [RFC] Alternative syntax for Nowdoc.
| From: | Guilliam Xavier | Date: | Wed, 30 Jun 2021 09:03:32 +0000 |
| Subject: | Re: [RFC] Alternative syntax for Nowdoc. | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115227@lists.php.net to get a copy of this message | ||
Hi,
Maybe other syntax could be used, but I don't know which. In javascript
> only a backtick is used:
>
> https://developers.google.com/web/updates/2015/01/ES6-Template-Strings
> .
> But in PHP this is used as eval.
>
Just a precision, because you keep referring to it as "eval", which makes
me "tick" (haha):
$cmd (i.e. $cmd wrapped in a pair of backticks) is the
same as shell_exec($cmd), not eval($cmd).
(BTW, one of JS "template strings" main selling points is string
substitution / variable interpolation, which is explicitly *not* wanted
with nowdoc [VS heredoc].)
As for the proposal, overall I agree with Rowan -- well, that would not be
exactly like single quotes (regarding [not] escaping them), but still "yet
another way" to write a nowdoc string literal.
PS: "amusingly", the code samples are hard to understand after rendered on
https://externals.io/message/115213
--
Guilliam Xavier