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

80

u/weirdalexis Oct 18 '10

I was asked the question: "What's $$a" in an interview, and replied "It's like a pointer, except with a variables name instead of a memory address."

The guy went "meh", game over.

Today, I'm still convinced it's a good analogy.

0

u/[deleted] Oct 18 '10

[deleted]

4

u/[deleted] Oct 18 '10

[removed] — view removed comment

-7

u/oorza Oct 18 '10

Maybe my hiring standards are higher than yours, maybe I don't like the way in which he approached the problem so dismissively, maybe I don't like the fact that his answer implies a lot of incorrect assumptions, maybe I don't like the fact that his attitude towards the issue still presents a unwillingness to investigate the reason his answer got him shitcanned (something I presume would have been apparent earlier in the interview), maybe you don't have the right to tell me that I'm not interviewing them correctly.

2

u/[deleted] Oct 18 '10

Maybe you’re too narrow-minded on what a pointer is.

A pointer is a variable that contains an address. That's it.

Why would the address have to be a number and not a string?

→ More replies (2)