Variable Variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Variable Variables

I'm little bit confused with variable variables $a.

23rd Jan 2018, 11:39 PM
Goundo
Goundo - avatar
2 Answers
+ 4
@schindlabua you confused me😵
24th Jan 2018, 3:08 AM
Lovely Jay
Lovely Jay - avatar
+ 2
It's a really obscure feature you will never need! But yeah, here's an example: $color = "red"; $thing = "color"; $thing == "color", therefor $thing == $color == "red". And `echo $thing` will print "red". It's always nice to know about the depths of your language because sometimes it may come in handy, but variable variables are just too deep. I haven't used them once, and I have never even seen code by others that uses them. I don't think there is a usecase.
24th Jan 2018, 12:11 AM
Schindlabua
Schindlabua - avatar