What is the difference between $message and $$message ?
Answers were Sorted based on User's Feedback
$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 |
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 |
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 |
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 |
Answer / abhilash
if $message1 = "hello";
and $message = "message1";
den $$message = hello
| Is This Answer Correct ? | 6 Yes | 9 No |
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 |
What is session in php why it is use?
Why do we use htaccess
How do you get the Browser information?
What should be the length of variable for SHA256?
how can i develop forum code? any one pleale help me on this question
How do I see how many pages per session in google analytics?
What is the name of the scripting engine that powers PHP?
Which cryptographic extension provide generation and verification of digital signatures?
Is null empty php?
What is the maximum size of a table in mysql?
How to read one character from a file?
How can I learn php fast?