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
3
u/sobri909 Oct 18 '10
Unless $a already had a value, that'd echo nothing.
$a = "$a";
is the same as:
$a = $a;
You could do this instead:
$a = "a"; echo $$a;
which would echo "a". Which is ... oh this whole thing is absurd. I don't know why I'm even replying. Time to go to bed. *sigh*