I have an array which starts out with 9 items. I need to split the array into equal groups, starting with 2 (the groups size will be variable though, hence why I need an equation). However, when I split the array into unequal groups, I cannot get the aesthetic effect I need and instead need to keep multiplying the array by a factor that will make equal groups.
I know how to check for multiple:
Code:
if ($groupsize % count($array) == 0) {
echo "Multiple.<br/>";
} else {
echo "Not Multiple.<br/>";
}
But I am really getting stuck on a formula to determine how many times I need to multiply the array, for the array to be divisable by the group size.
My array contains varying text data, that will simply be appended to itself until the final array can be divided into equal groups. The groups will then be manipulated using javascript to create a seamless carousel of sorts, hence the need for equal groups.
Any help with this, as I have got no clue.