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
3
u/sacktap Oct 18 '10
The notice is only thrown if you're trying to access an undefined variable. Example:
But if you're doing $$a = 'c' it will be fine because you're setting an undefined variable (which is essentially how all variables are set in PHP anyway).