PHP $ and $$ Variables

The $a is a variable with the $a  name that stores the value like string, int, float, etc.

The $$aa is a reference variable that stores the value of the $variable inside it.


$a = "xyz";  
$$b = 50;  
echo $a."
echo $$b."
echo $xyz;    

In the above example, we have assigned a value to the variable a as xyz. The value of the reference variable $$b is assigned as 50.

Now we have printed the values $a, $$b and $xyz.


Leave a Reply

Your email address will not be published. Required fields are marked *