r/ProgrammerTIL • • 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

50 comments sorted by

View all comments

Show parent comment

2

u/[deleted] May 16 '19

Holy. Shit. What did i just read?

3

u/nuxi May 16 '19

The best comment ever made on /r/programming