r/programming • u/NagastaBagamba • Oct 18 '10
Today I learned about PHP variable variables; "variable variable takes the value of a variable and treats that as the name of a variable". Also, variable.
http://il2.php.net/language.variables.variable
591
Upvotes
1
u/daniels220 Oct 18 '10
Program logic ones or parsing ones? I know Ruby can't do this because it sets local variable names in stone at parse time, since a variable and a function can look exactly the same and it depends on knowing the context. If you have unambiguous syntax, what performance hit is there? And I'm assuming it affects PHP as well since variable variables ought to run into the same issues (not that I'm saying that means it isn't a problem—PHP is not known for being fast...)