Re: [Discussion] Why can't I do "{$a::class}"?
| From: | Ilija Tovilo | Date: | Sun, 19 May 2024 11:22:52 +0000 |
| Subject: | Re: [Discussion] Why can't I do "{$a::class}"? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123367@lists.php.net to get a copy of this message | ||
On Sun, May 19, 2024 at 1:15 PM Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> Hi Peter
>
> On Sun, May 19, 2024 at 10:30 AM Peter Stalman <sarkedev@gmail.com> wrote:
> >
> > echo " {A::$static_property} \n"; // doesn't work (unless $static_property
> > is a variable)
> > echo " {$a::$static_property} \n"; // works
> >
> > echo " {A::static_method()} \n"; // doesn't work (just text)
> > echo " {$a::static_method()} \n"; // works
> >
> > echo " {A::constant} \n"; // doesn't work
> > echo " {$a::constant} \n"; // doesn't work either, but why?
>
> There were also suggestions to extend strings in a more generic way,
> akin to JavaScripts template strings [3], but I didn't have any use
> for this myself.
>
> [3]
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
What I actually wanted to reference were "tagged templates":
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
Sorry for the confusion.
Ilija