View Single Post
Old 11-25-2012, 11:47 PM   PM User | #1
Ulysses69
New Coder

 
Join Date: May 2004
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Ulysses69 is an unknown quantity at this point
Modulus operator to get next division

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.

Last edited by Ulysses69; 11-25-2012 at 11:55 PM..
Ulysses69 is offline   Reply With Quote