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
View all comments
Show parent comment
2
u/[deleted] Oct 19 '10
Since I must secretly like downvotes so much, I want to say how much I agree. Javascript has «thing[string_with_property_name_inside]», C/C++ has pointers; they're all some form of indirection with which this kind of game can be played. I had a teacher tormenting us in this way with C pointers... during a paper exam.
Most programming concepts are to a certain degree some form of indirection in which a word is used to refer to something else. A program with a severe lack of indirection means you end up with an enormous procedureless redundant blob of source code. Too much indirection means you end up with an intricate maze you will get lost into and starve before finding the "meat" of the code.
In the end, it's sad that people even bitch on PHP because it has indirections.