+ 3

What's the difference between $,$,$$?

I have doubt using dollar symbol in program

31st Jul 2017, 4:21 PM
R.Amrish babu.
R.Amrish babu. - avatar
3 Answers
+ 15
$ => Variable $ => Variable by Name $$ => Variable by Name x2 Take these examples: 1. $x = 5; echo $x; 《5》 2. $dog = 5; $x = "dog"; echo $x; 《5》 $x controls the value of "x" and returns the variable with that name, in this case... dog variable's value! 3. $dog = 5; $cat = "dog"; $x = "cat"; echo $$x; 《5》 $$x controls the value of "x" and returns the variable with that name, then.. $cat, this last contains the value "dog" and since we putted three dollar signs, it will returns the dog variable's value!
31st Jul 2017, 4:49 PM
Maz
Maz - avatar
+ 2
Thank you maz
31st Jul 2017, 4:57 PM
R.Amrish babu.
R.Amrish babu. - avatar
0
22.05.17
2nd Aug 2017, 9:11 PM
Mohammed Ali
Mohammed Ali - avatar