An interesting information about PHP variables is that they can be called using the variable values. That’s why these kind of variables are called variable variables. These can be used in the following way:
Usage of Variable Variables in PHP
PHP
1
2
3
4
5
6
7
8
9
<?php
$variable='variableName';
$variableName='This is the actual value which will be printed!';
echo$$variable;//this will print the value in the above variable.
?>
These kind of variables are used where we want to print the value by calling the variable with same name, but returns different values each time because the actual name of variable is dynamic.