Dynamically create variables in loop
Posted: Mon Apr 17, 2006 9:13 pm
Hi,
I have a for loop that I am in, and would like to store a piece of information. I would like to name this variable of information dynamically.
That is: for ($i = 0; $i < topNum; $i++){
$variable$i = topNum.field;
}
how can I do this, leaving me with $variable0, $variable1, etc ?
I am sure that there is a way -- I just am not getting the syntax right...
I have a for loop that I am in, and would like to store a piece of information. I would like to name this variable of information dynamically.
That is: for ($i = 0; $i < topNum; $i++){
$variable$i = topNum.field;
}
how can I do this, leaving me with $variable0, $variable1, etc ?
I am sure that there is a way -- I just am not getting the syntax right...