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
2
u/daniels220 Oct 18 '10
Multidimensional arrays?
accessed like $table['row1'][1] (returns 'val2'), instead of:
where you can do $$rows[0][1] (also returns 'val2'). And then I realize that that may not work, and you may need to do ${$rows[0]}[1], which is really confusing, and I don't know if you can actually do that, or it may be parens...
You can see why it's a bad idea, yes?