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



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

Answer / Neeraj Sahu

$var is a normal PHP variable, while $$var is a variable whose name is stored in another variable. For example, `$name = 'example'; echo $$name;` would output 'example'.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using regular expression of PHP?

6 Answers  


What is file upload?

1 Answers  


What does the unset() function means?

1 Answers  


What is cookie?

1 Answers  


Explain Traits in PHP?

1 Answers  


How do you format and output a number with leading zero's?

3 Answers  


Is polymorphism inherited?

1 Answers  


Which function can be used to exit from the script after displaying the error message?

1 Answers  


What is html used for?

1 Answers  


How to execute an sql query?

1 Answers  


How can we do user authentication without using session/cookies ? For ex:- From page1 accepts user name and password and need to check in all other pages whether the user has logged in or not

6 Answers   TCS,


How do you register one session ?

4 Answers  


Categories