PHP Developer Question:

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

Tweet Share WhatsApp

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 PDF Read All 57 PHP Developer Questions
Previous QuestionNext Question
How you can protect special characters in Query String?What is PEAR in PHP?