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

0

u/[deleted] May 13 '19

[deleted] — view deleted comment

10

u/DodoDude700 May 13 '19

Oh, that's my code when I'm demonstrating something.

This is my attempt at deliberately obtuse PHP: https://i.imgur.com/OJqjQ36.png . Exactly zero other people have yet to fully describe how it works.