Hello,
I am trying to find an equivalent to PHP's "Variable Variables".
Baisically, if I have an unknown number of variables (stuff_1, stuff_2, stuff_3, etc...) and want to reference them using a loop, I might try the following:
Code:
for(i=1; i<=num_variables; i++)
{
var tempstring = 'stuff_'+i;
var string = tempstring;
}
With this code, of course the variable 'string' will simply equal 'stuff_1' instead of what I want which is the value of the variable 'stuff_1'.
In PHP I would use the following:
Code:
for($i=1; $i<=$num_variables; $i++)
{
$tempstring = 'stuff_'.$i;
$string = $$tempstring;
//note the '$$'
}
Any help would be appreciated.
Thanks a lot.
-Keyper