PHP Arrays - help going Multidimensional

Associate
Joined
18 Oct 2002
Posts
710
Location
Somerset
I have being doing some work in php and have several arrays created that i now want group together inside another array,
I have read over several tutorials and articles on multidimensional arrays but i am not getting very far with it.

lets say i have 3 arrays

$array1

$array2

$array3

each of these arrays has 10 keys numbered 100, 90, 80 etc etc (they hold percentage details so that was a easy numbering system to use)

now i have these 3 arrays i want to group them into

$arrygroup

Can this be done after the first 3 are created and populated, or will it have to be done at the start and i need to alter everything else to point to the array in an array?

and will i get

$arraygroup[1] pointing to and returning the array $array1 etc etc.

If so how do i then 'get to' $array1[80] from inside $arraygroup ?

Is it anything like $arraygroup[1[80]] or am i waaaaay of the mark?

Thanks
 
Thanks Inquisitor,

After posting i went back and had a look at it again, got some where with it, and then stumbled upon how to make it work as i wanted, better than originally planned, which has in fact made the next step much easier.

Method isnt a million miles from your first example, but i have now ditched $array1 2 3 and gone straight into the multidimensional array and everything is now accessing $arraygroup which has now also allowed me to use a number where before i could not which can be +1 'd later in a while loop, solving another problem.

If that makes sense.
 
Back
Top Bottom