How to declare dynamic variable name like $$var in php?


#1

how to declare dynamic variable name like $$var in php?


#2

So, I’d recommend to use a namespace for that like this.

var myNamespace = {};

var myVar = "key";
myNamespace[myVar] = "some value";

#3

very thanks for your reply.