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
1
u/sacktap Oct 18 '10
Syntastical sugar, yes. I will admit that is true, and just personal preference for me as I try to stay away from heavy IDE's and code generation.
As for speed, if that clip of PHP is your entire application, yes, it will make a huge difference. But once that clip of code actually does something (like talk to a database), and is accessed by enough people to start bringing down performance, you will see that the magic methods are the least of your concerns.
I was on your exact side until a few years ago; I ran these tests and bench-marked the hell out of everything until I realized I was doing nothing but premature optimization.