Gah! I was reading about variable variables the other night!! Damn my memory!
I just bombed an interview question asking what does this line do:
$$foo = "x";
I knew I had seen it, and I knew it was a newer feature for PHP5.
It’s to do with PHPs variable variables feature. In a nutshell, it allows you to set dynamic variable names.
$x = 9; $foo = "x"; echo $$foo; //prints 9
So the correct answer to “What does that statement do?” would have been “refers to variable $x”. That’s one feature of PHP I won’t soon forget.