PHP message - Explain the difference between $message and $$message?

Explain the difference between $message and $$message?

$message is used to store variable data. $$message can be used to store variable of a variable. Data stored in $message is fixed while data stored in $$message can be changed dynamically.

Example:
$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)

Explain the difference between $message and $$message in PHP

$message is a variable and $$message is a variable of another variable.

Example
$Message = "YOU";
$you= "Me";

echo $message //Output:- you
echo $$message //output :-Me

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

PHP Include & Require - What is the difference between include and require?
PHP Include & Require - Require () and include () are the same with respect to handling failures....
PHP Urlencode & Urldecode - What is urlencode and urldecode?
PHP Urlencode & Urldecode - Urlencode can be used to encode a string that can be used in a url..
PHP Errors - What are the different types of errors in PHP?
PHP Errors - Different types of errors are......
Post your comment