0

I've got multiple variable like : $variable0, $variable1, $variable2.

Is it possible to use them in a loop ?

Example I tried but doesn't work:

for($i = 0;$i < 10;$i++){
    $myarray[] = $variable.$i;
}

EDIT:

My real variable is : $game->stats->item0

and : ${"game->stats->item".$i} doesn't work it tell me : Undefined variable: game->stats->item0 The $ is missing

Thank you.

Leeroy521
  • 81
  • 1
  • 3

0 Answers0