What is the difference between $message and $$message?
They are both variables. But $message is a variable with a fixed name.
$$message is a variable who‘s name is stored in $message.
For example
if $message contains ―var1, $$message is the same as $var.
Detailed Code :
<?php
//Dear Techies this Script has one simple variable ie
$car_name = 'Ford';
//now assign variable $car_name to $get_car_name
$get_car_name = $car_name;
echo $get_car_name.'<br>';
//answer is : Ford;
//this is simple variable..
//we can get the same answer in different technique..this can be done by
//using reference variable or variable of variable or using $$ dollar sign
//check this
$get_car_name_using_ref_var = 'car_name';
echo $$get_car_name_using_ref_var;
?>
I think now you can understand the difference between variable and reference variable in PHP
if u like this post, please put your valuable comments..
They are both variables. But $message is a variable with a fixed name.
$$message is a variable who‘s name is stored in $message.
For example
if $message contains ―var1, $$message is the same as $var.
Detailed Code :
<?php
//Dear Techies this Script has one simple variable ie
$car_name = 'Ford';
//now assign variable $car_name to $get_car_name
$get_car_name = $car_name;
echo $get_car_name.'<br>';
//answer is : Ford;
//this is simple variable..
//we can get the same answer in different technique..this can be done by
//using reference variable or variable of variable or using $$ dollar sign
//check this
$get_car_name_using_ref_var = 'car_name';
echo $$get_car_name_using_ref_var;
?>
I think now you can understand the difference between variable and reference variable in PHP
if u like this post, please put your valuable comments..






