What is the difference between $var and $var ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between $var and $var ?

What is the use of $var in PHP ?

17th Sep 2016, 6:17 PM
Narendra
Narendra - avatar
3 Answers
+ 3
$ allows you to use the value of a variable as the name of another. $var = "foo"; $var = "bar"; echo $foo;
17th Sep 2016, 7:01 PM
Zen
Zen - avatar
+ 3
variable treat the value of another variable ast it name $a=`hi' $hi='hello' echo$a
20th Sep 2016, 7:33 AM
rachana dhenge
rachana dhenge - avatar
0
For example if, $thisVar is holding value "otherVar" and $otherVar is holding value "Hello i'm other var" and then when echo value of $thisVar using var var syntax $thisVar, the resulting value will be "Hello i'm other var" bcoz $thisVar is holding the name of otherVar.
27th Sep 2016, 2:51 PM
ubaid khan