1

How to get a var into a var, Example:

$gameid = 5;
$game{$gameid} = active;

So, I want var $game5 to be set to active.

How to do this?

Thanks.

Greetings. Jonathan

  • If you find you're assigning numbers to variables, then you probably have a prima facie case for using an array instead – Mark Baker Sep 20 '15 at 19:27

1 Answers1

2
$gameid = 5;
${"game" . $gameid} = "active";

echo $game5; //Echoes Acive
Juan Bonnett
  • 1,823
  • 1
  • 15
  • 33