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

1

u/darkon Oct 18 '10

I agree with you. Just because a language lets you shoot yourself in the foot doesn't mean it's a good idea or that you should. :-)

I don't know about PHP, but if you enable strictures in Perl ('use strict;') then trying to use a "soft" reference will result in a compiler error. Leaving strictures turned off is for quick-and-dirty use-once programs.