Re: RFC: Short echo tag can also call closures
| From: | Dusk | Date: | Mon, 18 Sep 2023 18:40:45 +0000 |
| Subject: | Re: RFC: Short echo tag can also call closures | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121093@lists.php.net to get a copy of this message | ||
On Sep 18, 2023, at 11:18, Shailesh Humbad <shailesh@atensoftware.com> wrote:
> INSTEAD:
> Change the short echo tag "<?= $x ?>" to be equivalent to "<?php
> is_callable($x) ? $x() : echo $x; ?>", which allows view model properties to be defined as
> closures.
Surely this can already be accomplished unambiguously using syntax like
<?= $x()
?> or <? ($model->title)() ?> ?
In any case, this seems like a non-starter, as it would substantially change the behavior of some
existing code, e.g. when echoing objects which implement both __invoke() and __toString().