In any programming language (like php, java, javascript etc) is it possible to dynamically create a changing number of variables in a loop, within a given name space?
for example, if I want to create N variables that have random numbers between 1 and 5, which are to be called random1, random2 .. randomN, is it possible to do something like:
loop ( N ){<br>
create variable randomN = random(1,5);<br>
}
In PHP you could use variable variables:
In JavaScript, same thing:
Though, I would recommend using a “container” to hold those variables, so that they’re not created globally.