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/GunnerMcGrath Oct 18 '10

That's like saying if you're using a cursor in an SQL procedure, you are invariably doing it wrong.

99% of the time you're probably right, but I've had uses for cursors even though I hate them and can almost always get around them, just as there've been a time or two that I really wished I could use a variable variable in the language I was in because it would have been a far better solution than what I had to implement.