Reputation: 7472
I have the following array:
Array {
[0] => text1
[1] => text2
[3] => text3
[4] => text4
...
[200] => text200
}
How can I create a foreach loop that will divide the above array to create a sub array for every 3 elements?
Array {
[0] => Array {
[0] => text1
[1] => text2
[2] => text3
}
[1] => Array {
[0] => text4
[1] => text5
[2] => text6
}
......
}
Upvotes: 3
Views: 191