I have an array of file names which gets split into 3's using array_chunk, then using array_push "X" is added to each array chunk. I now want to to reassemble the array chunks into one "2D" array. I have been playing around with array_merge, but I can only get the last array chunk to merge over and over. So...
I have an array ($filesOUT) that looks like this:
Array (
[0] => DSCF2361A1.jpg [1] => DSCF2373.JPG [2] => DSCF2383.JPG [3] => X
)
Array (
[3] => DSCF2347.JPG [4] => DSCF2335.JPG [5] => DSCF2366.JPG [6] => X
)
Array (
[6] => IMG_3864.JPG [7] => DSCF2375.JPG [8] => DSCF2336.JPG [9] => X
)
Array (
[9] => DSCF2369.JPG [10] => DSCF2346.JPG [11] => DSCF2378.JPG [12] => X
)
Array (
[12] => IMG_3861.JPG [13] => DSCF2368.JPG [14] => IMG_3859.JPG [15] => X
)
Array (
[15] => IMG_3867.JPG [16] => DSCF2395.JPG [17] => DSCF2357.JPG [18] => X
)
Array (
[19] => IMG_3880.JPG [20] => X
)
But I would like to merge the multidimensional array ($filesOUT) so that it becomes a single "2D array" like so:
Array (
[0] => DSCF2361A1.jpg [1] => DSCF2373.JPG [2] => DSCF2383.JPG [3] => X [4] => DSCF2347.JPG [5] => DSCF2335.JPG [6] => DSCF2366.JPG [7] => X [8] => IMG_3864.JPG [9] => DSCF2375.JPG [10] => DSCF2336.JPG [11] => X [12] => DSCF2369.JPG [13] => DSCF2346.JPG [14] => DSCF2378.JPG [15] => X [16] => IMG_3861.JPG [17] => DSCF2368.JPG [18] => IMG_3859.JPG [19] => X [20] => IMG_3867.JPG [21] => DSCF2395.JPG [22] => DSCF2357.JPG [23] => X [24] => IMG_3880.JPG [25] => X
)
Is this possible? (baring in mind that the array_push does not amend the key number, and causes key duplicates. SEE RED)
Failing that is there any other way I can use array_push to add "X" after every 3rd item in the array?...
If anyone can shed some light on the situation it would be greatly appreciated. Thanks :)