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 is the comparison of objects done in php?
How can we define a variable accessible in functions of a php script?
How to merge values of two arrays into a single array?
Can you define an argument as a reference type?
sort term descripttion form, report and uery
Is server side a session?
How to close a session properly?
What are the different tables(engine) present in mysql, which one is default?
What is a helper function?
How do you debug php?
Is it possible to use com component in php?
Tell me are parent constructors called implicitly inside a class constructor?
What is form action php?
How many types of php frameworks are there?
Is it possible to destroy a cookie?