> 
> How would you like it to work, if you pass a variable name variable to
> compact then?
> $x = 123;
> $name = 'x';
> (fn () => compact($name))();
> 

Although it is difficult to make it work in general (of course), there is the 
specific case of names given as literal strings, as in the example provided by 
the OP, that does not suffer from the impossibility of static analysis.


> I agree with the idea of deprecating compact() & extract() and in
> long-term variable of variables as well.

However, in `compact('x', 'y')`, the name of the variables are not variable, 
they are constant.

—Claude

Reply via email to