Split foreach code based on even/odd
<p>I currently use a code to display some content in my Magento shop.
But now I want to split the loaded content based on even/odd into two different divs.</p>

<p>My current code is displayed below.</p>

<p>How can I split the code based on even/odd so that I get to <code>&lt;div class="block-specs"&gt;</code>.</p>

<p>I want a div <code>&lt;div class="block-specs odd"&gt;</code> and <code>&lt;div class="block-specs even"&gt;</code></p>

<p>How can I achieve that?</p>

<p>Current code:</p>

<pre><code>&lt;?php if($_additionalgroup = $this-&gt;getAdditionalData()): ?&gt;
&lt;section id="additional"&gt;
&lt;div class="box-collateral box-additional"&gt;
    &lt;h2&gt;&lt;?php echo $this-&gt;__('Additional Information') ?&gt;&lt;/h2&gt;

    &lt;?php $i=0; foreach ($_additionalgroup as $_additional): $i++; ?&gt;
    &lt;div class="block-specs-&lt;?php echo $i?&gt;"&gt;
        &lt;h3 class="specs-&lt;?php echo $i?&gt;"&gt;&lt;?php echo $this-&gt;__( $_additional['title'] )?&gt;&lt;/h3&gt;
        &lt;table class="data-table specs-&lt;?php echo $i?&gt;" id="product-attribute-specs-table-&lt;?php echo $i?&gt;"&gt;
            &lt;col width="25%" /&gt;
            &lt;col /&gt;
            &lt;tbody&gt;
            &lt;?php foreach ($_additional['items'] as $_data): ?&gt;
             &lt;?php $_attribute = $_product-&gt;getResource()-&gt;getAttribute($_data['code']);
    if (!is_null($_product-&gt;getData($_attribute-&gt;getAttributeCode())) &amp;&amp; ((string)$_attribute-&gt;getFrontend()-&gt;getValue($_product) != '')) { ?&gt;
                &lt;tr&gt;
                    &lt;th class="label"&gt;&lt;?php echo $this-&gt;htmlEscape($this-&gt;__($_data['label'])) ?&gt;&lt;/th&gt;
                    &lt;td class="data"&gt;&lt;?php echo $_helper-&gt;productAttribute($_product, $_data['value'], $_data['code']) ?&gt;&lt;/td&gt;
                &lt;/tr&gt;
            &lt;?php } ?&gt;
            &lt;?php endforeach; ?&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/div&gt;
        &lt;script type="text/javascript"&gt;decorateTable('product-attribute-specs-table-&lt;?php echo $i?&gt;')&lt;/script&gt;
    &lt;?php endforeach; ?&gt;

&lt;/div&gt;
&lt;/section&gt;
&lt;?php endif;?&gt;
</code></pre>