Lets say I have a variable called $file and the for loop: for($i=1; $i <= 5; $i++) {}
for($i=1; $i <= 5; $i++) {}
For each iteration of the for loop, the $i value w
$i
Use ${'varname'} syntax:
for($i=1; $i <= 5; $i++) { ${'file' . $i} = $i; }
However, it's often better to use arrays instead of this.