|
How do I divide an array into multiple arrays?
Hi there, I am trying to divide a single array into multiple arrays using a $variable. The $variable is the number of fields in my database table.
For example, if $variable = 3...
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
[7] => 8
[8] => 9
[9] => 10
[10] => 11
[11] => 12
)
Would become...
Array[0]
(
[0] => 1
[1] => 4
[2] => 7
[3] => 10
)
Array[1]
(
[0] => 2
[1] => 5
[2] => 8
[3] => 11
)
Array[2]
(
[0] => 3
[1] => 6
[2] => 9
[3] => 12
)
The array could either divided into a multi-dimensional array or 3 separate arrays, either would work.
If someone knows of a way to do this would be of great help. Basically I am trying to create a search class that gathers all database table fields and row data then shows the results in a table. If someone has also done something similar please let me know!!!
Thanks
Last edited by shaneog; 01-07-2009 at 03:04 PM..
|