On Sat, Mar 12, 2022 at 3:11 AM BohwaZ <p...@bohwaz.net> wrote:

> This RFC is confusing two different things:
>
> 1. variables inside strings (options 1, 2, 3)
> 2. dynamic variables names (option 4)
>
> The 4th one is very useful.
>
> $v = ${'param_' . $name};
>

Please don't ever ever ever write code like that!


> There is no other practical way to do that, so removing that feature
> would mean breaking something useful with no replacement.
>

While it's still a problematic way of writing code, you can use arrays
instead:
`$v = $something['param_' . $name] ?? null;

This at least keeps all the issues to the scope of `$something`.


> Also why break something that works and is used?
>

Variable variables should be removed from PHP asap. It's 2022 and I still
encounter bugs due to this "working" in legacy applications.

Reply via email to