What is the difference between $message and $$message ?

Answers were Sorted based on User's Feedback



What is the difference between $message and $$message ?..

Answer / prasad

$message is variable and $$message is variable variable.
$message="hello";
$$message="world";
echo $hello; // prints world
echo ${$message} //prints world

variable variable cant be used in php superglobalarray. and
cant use in functions and within classes

Is This Answer Correct ?    25 Yes 6 No

What is the difference between $message and $$message ?..

Answer / sakthivel

$var1 = "hello world";
$var2 = $var1;
$$var2 = "hello world";

Is This Answer Correct ?    6 Yes 2 No

What is the difference between $message and $$message ?..

Answer / vikram

$message="hello";
$hello="world";
echo $$message;
// will print "world"..this concept is called "variable of
variables"...

Is This Answer Correct ?    6 Yes 3 No

What is the difference between $message and $$message ?..

Answer / mohit

$message is a variable and $$message is a refrence variable
that have the refrence of $message.

Is This Answer Correct ?    5 Yes 2 No

What is the difference between $message and $$message ?..

Answer / laxmikanta pradhan

$message is variable and $$message is variable variable i.e.
$message is a variable whereas $$message is a refrence
variable having the refrence of $message.
Ex. $message="hello";
$$message="world";
echo $hello; // prints world
echo ${$message} //prints world

Is This Answer Correct ?    3 Yes 0 No

What is the difference between $message and $$message ?..

Answer / abhilash

if $message1 = "hello";
and $message = "message1";
den $$message = hello

Is This Answer Correct ?    6 Yes 9 No

What is the difference between $message and $$message ?..

Answer / keshab

$test = "example";
$temp = "test";

echo $temp // output is "test";
echo $$temp// output is "example";

thanks

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More PHP Interview Questions

How I use global variable in another page without using $_GET method?

9 Answers  


What is the difference between characters 34 and x34?

0 Answers  


How to calculate the difference between two dates using php?

0 Answers  


How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', )

2 Answers  


What is echo and print in php?

0 Answers  






What is super () python?

0 Answers  


Which is better wamp or xampp?

0 Answers  


can anyone explain about stored procedure,Triggers and transaction in php?

2 Answers  


can any please tel me about "Expression Engine"

1 Answers  


Can php variables have numbers?

0 Answers  


what will do ceil() and floor() in PHP?

5 Answers  


Tell me what is htaccess?

0 Answers  


Categories