View Single Post
Old 07-14-2005, 01:37 PM   #1 (permalink)
phill2000star
Registered User
 
Join Date: Jul 2005
Posts: 4
phill2000star is on a distinguished road
Using vars to create an array??

Hiya,

Is this possible?

I want the user to submit a number and to create a number of arrays equal to that number, each of them including that an icrimental number in the name of the array.

EG.

User submits the number 4 which is asigned to the variable $noOfArrays. This should create the following arrays -

array1[]
array2[]
array3[]
array4[]

I thought about doing a loop to produce each of the arrays, but I'm stuck. for example i thought about using the following code, but dont know any other way of doing it.

Code:
for ($i = 0; $i < $noOfArrays ; $i++) {
array.$i = array();}
Does anyone understand me? i was trying to use the . to join the word array and the variable $i to creat the following - array0[] array1[] array2[] and array3[].

I am doing something wrong but for the life of me cant decide how else to do it??....

Any ideas please!?!?

Many thanx!!
phill2000star is offline   Reply With Quote