What is the difference between $message and $$message?
Answer Posted / seema
$message is a simple variable and $$message is variable of a
variable(also known as dynamic variable).
For Example:
$message = "welcome";
$welcome = "to php programming tricks!!!";
echo $message; // Output: welcome
echo "<br>",$$message; // Output: to php programming tricks!!!
You will notice with the second echo it will check the
variable $message for it's value and it's value is the
string "welcome". So then it searches for $welcome and finds
the final value which it yields.
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
Is php a web server?
Where can I learn php?
Tell me how do you define a constant?
What is the use of anonymous function in php?
Is age interval or ordinal data?
Why do we use namespace in php?
What is composer install?
How can we get ip address of a client in php?
What is php simple definition?
How are sessions maintained?
Tell me what is the difference between the functions strstr() and stristr()?
How do I stop a php script?
Is php easy language to learn?
What is the difference between characters and #?
What is php and how do you use it?