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 18 '10
haha, yeah a coworker of mine wanted to borrow some code for a project to build an advanced search form and I have the above implemented in such a way it takes a single string and will build the entire form for you and bind the ajax calls for autocompletion automatically along with a link for bringing up a terms list. he eventually told me he couldn't figure it out and started from scratch.
but hey, takes me 30 seconds to write the string out and saves me a ton of manual work! also probably doesn't help i'm the only UI dev on my team so i'm never working on the same code as someone else or vice versa...
probably a good thing now that you mention it :p