Trying to do something that I think should be very simple. Let's assume that I have an array populated with the numbers 1 to 24 for this example.
I need to output these items in 4 columns to accomodate my CSS layout but still have them read from left to right, top to bottom. I also want this to be somewhat dynamic - I'm okay hardcoding it to split into 4 columns, but need it to handle any number of items in the array.
I'm not sure if the best way to do this would be to split the original array into an array for each of the 4 columns, or to loop through the original array 4 times and output items 1+4, 2+4, and so on. Or maybe I should be using array_filter with some custom callback functions. I'm fine with any solution.
The end result is echoing the array in the following groupings so I can surround each column with the appropriate column HTML for layout (in this case the array actually contains IMG urls):
Column 1: 1, 5, 9, 13, 17, 21
Column 2: 2, 6, 10, 14, 18, 22
Column 3: 3, 7, 11, 15, 19, 23
Column 4: 4, 8, 12, 16, 20, 24
Any help would be appreciated! This one is driving me nuts and I know it should be relatively easier. Guess I should stick to HTML + CSS.