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
How to register a variable in PHP session?
Where session is stored?
Which is better wamp or xampp?
What is 'float' property in css?
Is php better than python?
Who is the father of php and what is the current version of php and mysql?
How can we display information of a variable and readable by human with php?
How is it possible to set an infinite execution time for php script?
Steps for the payment gateway processing?
Does jwt protect against csrf?
What is api laravel?
Can we extend multiple classes in php?
What is the meaning of die in php?
What is php and what does it do?
How to read a file in binary mode?