Hard to put a descriptive title to this which is easy to understand so I will try in more depth here. Say I have 4 arrays of different sizes, a1, a2, a3 and a4 which I want to combine into the array SUM.
I want SUM[0] to be a1[0], SUM[1] to be a2[0], SUM[2] to be a3[0], SUM[3] to be a4[0] and then SUM[4] to be a1[1] and so on.
A tricky thing to consider is the arrays are different sizes.
edit: if any array a1,a2,a3,a4 terminates, just move onto the next one – sorry for not making this clear
OUTPUT:
array(15) {
[0]=>
int(1)
[1]=>
int(4)
[2]=>
int(10)
[3]=>
int(12)
[4]=>
int(2)
[5]=>
int(5)
[6]=>
int(11)
[7]=>
int(13)
[8]=>
int(3)
[9]=>
int(6)
[10]=>
int(14)
[11]=>
int(7)
[12]=>
int(15)
[13]=>
int(8)
[14]=>
int(9)
}