+ 3
What's the difference between $,$,$$?
I have doubt using dollar symbol in program
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!
+ 2
Thank you maz
0
22.05.17