PHP Developer Question:
Download Questions PDF

Can you please explain the difference between $message and $$message?

Answer:

They are both variables. But $message is a variable with a fixed name. $$message is a variable who's name is stored in $message. For example, if $message contains "var", $$message is the same as $var.

$message is a simple variable whereas $$message is a reference variable. Example:
$user = 'bob'
is equivalent to
$holder = 'user';
$$holder = 'bob';

Download PHP Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How you can protect special characters in Query String?What is PEAR in PHP?