why we use double dollar sign? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why we use double dollar sign?

$ ??

28th Sep 2016, 8:38 AM
Haroon Fareed
Haroon Fareed - avatar
4 Answers
+ 6
The variable of the name in the variable: $Bar = "a"; $Foo = "Bar"; $World = "Foo"; $Hello = "World"; $a = "Hello"; $a; //return Hello $a; //return World $$a; //return Foo $$a; //return Bar $$$a; //return a $$$a; //return Hello $$$$a; //return World //... And so on
28th Sep 2016, 12:41 PM
Dmitri Daranuta
Dmitri Daranuta - avatar
+ 2
Dmitri, the sixth dynamic variable ($$$a) won't return Hello. But instead it'll show an runtime error that the next variable (after echoing "a") is missing or not defined.
30th Sep 2016, 7:54 PM
Shitanshu Sharma
Shitanshu Sharma - avatar
+ 1
$a="hello"; $hello="word"; echo $a; actually $a is a variable that is using the value of another variable , in $a $ denote it's a variable and $a as it's name . the value of $a is= to "hello" . the resulting variable $hello , which is holds the value world.
12th Feb 2017, 1:56 PM
ravi ranga
ravi ranga - avatar
used to print the next variable
28th Sep 2016, 1:55 PM
Driss Baidou
Driss Baidou - avatar