Difference between $variable and $$variable

Indirect Reference used in the $$variable.
We explain the difference between $variable and $$variable through below example:-

Suppose, we create two variables.
(1) $variable which has value name.
(2) second variable name is the value of the first variable.


<?php
$variable = "name";
$name="John";
echo $$variable;
?>
Output: John

Work Flow of the above example


$$variable;

$$variable now process will work from right to left.


$name

after that output is


John