I showed someone how you can create variable variables of variables in PHP (I would recommend using NEVER, this is a terrible practice, and you are a bad person if you use variable variables in the actual production code), and they asked if in this case the sign The dollar acted as the dereferencing operator.
In fact, it does not create a link to other variables, so I really do not see the deref function in it. The documentation for variable variables doesn't even mention references at all.
Who is right? I don’t think variable variables create links, and therefore the dollar sign is not an dereference operator.
Here is a sample code for the pleasure of your viewing (or pain, given the content):
<?php $a = 'c'; $b = 'a'; $c = 'hello'; echo($$$b);
source share