List column logic
<p>I have a bunch of list items and I want to arrange them into 3 columns, alphabetically from top to bottom, left to right. This is easy enough to do by dividing the total amount of items by 3 and spitting them out. The other thing I need to do though is to keep the amount of items in each column even, starting at 4 per column.</p>

<p>Example:</p>

<pre><code>A    E    I
B    F    J
C    G    K
D    H    L
</code></pre>

<p>So if there were &lt;= 4 items, it would just be 1 column</p>

<pre><code>A    
B        
C        
D
</code></pre>

<p>The 5th item would start column 2 and the 9th would start column 3.</p>

<p>If there are > 12 items, it always adds it to the end of the rightmost column, starting a new row if the other columns have equal amounts of rows. Still maintaining alpha sort order.</p>

<p>So for 14:</p>

<pre><code>A    F    K
B    G    L
C    H    M
D    I    N
E    J
</code></pre>

<p>And 16:</p>

<pre><code>A    G    L
B    H    M
C    I    N
D    J    O
E    K    P
F
</code></pre>

<p>I'm doing this on the server side and loading up 3 arrays (one for each column) so for 16 items it would be:</p>

<pre><code>$left_col = array('A', 'B', 'C', 'D', 'E', 'F');
$mid_col = array('G', 'H', 'I', 'J', 'K');
$right_col = array('L', 'M', 'N', 'O', 'P');
</code></pre>

<p>I want to keep this logic on the server side (PHP) rather than handle it with Javascript.</p>
