I assume the variables are called $ test0, $ test1, ..., $ test5. You can use the following:
${"test".$i}
Although, can I suggest you make $ test an array and use $ i instead of the index instead? It is very strange to use $ i as an index to scroll through the list of variable names.
As an example, instead of <
$test0 = "hello"; $test1 = "world";
Using:
$test[0] = "hello"; $test[1] = "world";
Dazarath
source share