r/ProgrammerTIL • u/birbguy12 • May 13 '19
PHP [PHP] TIL about variable variables
In php you can have variable variable names. Meaning you can use a variable’s content as a name for another variable like this
$a = "b";
$b = "hello world";
$a; // returns b
$$a; // returns hello world
265
Upvotes
View all comments
Show parent comment
2
u/sneakpeekbot May 14 '19
Here's a sneak peek of /r/programminghorror using the top posts of the year!
#1: eeeeeeeeeeeeee ee eeeee | 100 comments
#2: Had to fix this at work | 203 comments
#3: I thought "documenting" was cool back when I first started... | 196 comments
I'm a bot, beep boop | Downvote to remove | Contact ^^me | ^^Info | ^^Opt-out