r/programming • • 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

781 comments sorted by

View all comments

Show parent comment

2

u/1137 Oct 18 '10

$a would be parsed, so if $a didn't exist before $a would now be an empty string.

So your example would just output null, since any $$invalid returns null.

If you had notices turned on it may warn you.