$a = array(8, 16, 16, 32, 8, 8, 4, 4);
With an array like above, there is a way so that I can split / split the array based on the value summing up to the given value. for example, if I wanted them to be 32. My last array will have up to 100 values, all of which will be 32, 16, 8 or 4, and I just need to group the elements so that the value always equals the set amount, so in this example its 32.
From the array above, I would hope to get:
$a[0][1] = 16 $a[0][2] = 16 $a[1][3] = 32 $a[2][0] = 8 $a[2][4] = 8 $a[2][5] = 8 $a[2][6] = 4 $a[2][7] = 4
since $ a [0] sums up to 32, and therefore $ a [1] and $ a [2].
source share