+ 1

How $ variable works?

how $ variable works in php $a="name"; $a="age"; echo $name; //output : age

30th May 2017, 8:04 PM
kaushal singh
kaushal singh - avatar
2 Antworten
+ 3
$name = $(name)=$($a) = $a = age
30th May 2017, 8:21 PM
Thanh Le
Thanh Le - avatar
+ 7
variables with $ change their name according to the string the one with only $ contains. so in your example $a becomes $name, because $a contains the string "name". I'm still searching for a practical use for this. never needed it before. can be really confusing.
30th May 2017, 8:21 PM
Mario L.
Mario L. - avatar