Sr. PHP Programmer Question:

Download Job Interview Questions and Answers PDF

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

Senior PHP Programmer Interview Question
Senior PHP Programmer Interview Question

Answer:

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

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
Are objects in PHP 5 passed by value or reference?What does "&" mean in '&$var'?