$message stores variable data while $$message is used to store variable of variables.
$message stores fixed data whereas the data stored in $$message may be changed dynamically
$message stores variable data while $$message is used to store variable of variables.
$message stores fixed data whereas the data stored in $$message may be changed dynamically
$message is a normal variable; $$message is a variable variable: it uses the value of $message as the name of another variable.
<?php
$message = "greeting";
$$message = "Good morning"; // creates $greeting = "Good morning"
echo $message; // greeting
echo $$message; // Good morning
echo $greeting; // Good morning
?>
Here $message holds the string "greeting". Writing $$message means "the variable whose name is the value of $message", that is $greeting. So the name of the second variable is decided at run time. Both are ordinary variables whose values can change; the difference is only that $$message refers to a variable indirectly by name.
Log in or create a free account to answer this question.