PHP - Alternate row colours based on a 'grouping' value in an array
<p>There's probably an easy answer to this, but I just haven't been able to get my head around it.</p>

<p>I have the following array:</p>

<pre><code>Array
(
    [0] =&gt; Array
        (
            [meeting_grouping] =&gt; 1
            [client_first_name] =&gt; Nikolay
        )

    [1] =&gt; Array
        (
            [meeting_grouping] =&gt; 1
            [client_first_name] =&gt; Konstantin
        )

    [2] =&gt; Array
        (
            [meeting_grouping] =&gt; 1
            [client_first_name] =&gt; Andrey
        )

    [3] =&gt; Array
        (
            [meeting_grouping] =&gt; 4
            [client_first_name] =&gt; Eddie
        )

    [4] =&gt; Array
        (
            [meeting_grouping] =&gt; 4
            [client_first_name] =&gt; Neil
        )

    [5] =&gt; Array
        (
            [meeting_grouping] =&gt; 6
            [client_first_name] =&gt; Ian
        )

    [6] =&gt; Array
        (
            [meeting_grouping] =&gt; 6
            [client_first_name] =&gt; Mark
        )
)
</code></pre>

<p>What I would like to do is output this data to an HTML table and colour code the rows. I know how to alternate the row colours, but in this case I need it to be colour coded based on the 'meeting_grouping'. I.e. Nikolay, Konstantin and Andrey (meeting_grouping = 1) would have a grey background, Eddie and Neil (meeting_grouping = 4) would have a white background and Ian and Mark (meeting_grouping = 6) would have a grey background again.</p>

<p>If someone could point me in the right direction it would be much appreciated.</p>

<p>Thanks in advance!</p>
