Basic PHP Programming Question:

Download Job Interview Questions and Answers PDF

What is the difference between $message and $$message?

PHP Interview Question
PHP Interview Question

Answer:

Anwser 1:
$message is a simple variable whereas $$message is a reference variable. Example:
$user = 'bob'

is equivalent to

$holder = 'user';
$$holder = 'bob';


Anwser 2:
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.

Download PHP Interview Questions And Answers PDF

Previous QuestionNext Question
How can we repair a MySQL table?What Is a Persistent Cookie in PHP?