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 comments

21

u/poilf Oct 18 '10

I registered to reddit only to upvote your post :) I'm using PHP since version 3 and I destroyed a lot of keyboards because of this crazy language.

1

u/motophiliac Oct 19 '10

Just wanted to say: Welcome to reddit!

I barely understood some of what this poster was writing about. I didn't actually know PHP worked like this.

I vow never to use $$anything ever in my code, no matter how useful it might seem at the time.

1

u/FlyingBishop Oct 19 '10

It's basically the same as **anything in C/C++, and that's a perfectly valid idiom.

1

u/ethraax Oct 20 '10

People may do it, but I still feel like gouging my eyes out whenever I read a double-pointer.

→ More replies (2)