Using Variable Variables in PHP - The Never-ending Variable (
Page 6 of 7 )
Another interesting quirk about variable variables is that they are seemingly
infinite. The following code works just fine to produce "The Great Thing About
Variable Variables Is They Never End!":
$x = "The";
$$x = "Great";
$$$x = "Thing";
$$$$x = "About";
$$$$$x = "Variable";
$$$$$$x = "Variables";
$$$$$$$x = "Is";
$$$$$$$$x = "They";
$$$$$$$$$x = "Never";
$$$$$$$$$$x = "End!";
echo "$x ${$x} ${${$x}} ${${${$x}}} ${${${${$x}}}} ${${${${${$x}}}}}
${${${${${${$x}}}}}} ${${${${${${${$x}}}}}}} ${${${${${${${${$x}}}}}}}}
${${${${${${${${${$x}}}}}}}}}";