Site icon Learn Web Development & Programming, Artificial Intelligence, WordPress, Shopify Articles

Explain the difference between $message and $$message?

$var1 = ‘Variable 1’
$$var1= ‘variable2’
This can be interpreted as $ Variable 1=‘variable2’;
For me to print value of both variables, I will write
$var1 $($var1)
$Message = "YOU";
$you= "Me";
echo $message //Output:- you
echo $$message //output :-Me

$$message allows the developer to change the name of the variable dynamically.

Exit mobile version