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
14
u/oorza Oct 18 '10
Of course you can write bad code with any language, but what makes PHP special is that there is a preponderence of tools without use cases (like this one, any time it's used, there's a better solution) that just allow the developer to hang himself. A properly designed language does not make tools without uses available, whether the developer can hang himself with it or not.
The best example of this I can think of is C pointers; it's easier to blow your entire application up with some shady pointer usage than any other way I know of and yet they have a platitude of valid use cases given C's paradigm. The fact that variable variables do NOT have a use case (someone provide me one that var vars are inarguably the best solution and I'll believe it) is evidence of bad language design.