Neither if nor else will run
<p>I don't know what the problem is. </p>

<p>This is the code that is the problem:</p>

<pre><code>$thisvb = (int) $key2;
if ($thisvb == ($lastvb + 1)) { //This don't work
    echo '&lt;li&gt;';
} else { echo '&lt;li value="' . $key2 . '"&gt;';}
$last = (int) $key2;
</code></pre>

<p>Below is the full code.</p>

<pre><code>&lt;?php
$voiceboxes = array(
    '141133'    =&gt; array(
        '1'     =&gt; array(
            'Title' =&gt; 'Title2',
            'Link'  =&gt; 'http://...',
        ),
        '2' =&gt; array(
            'Title' =&gt; 'Title3',
            'Link'  =&gt; 'http://...',
        ),
        '3' =&gt; array(
            'Title' =&gt; 'Title4',
            'Link'  =&gt; 'http://...',
        )
    )
);
$last = 0;
//$this = 0;
echo "&lt;ol&gt;\n";
foreach ($voiceboxes as $key =&gt; $value) {
    $lastvb = 0;
    $thisvb = 0;
    //$voiceboxes[$key]['title']
    echo "&lt;ol&gt;\n";
    foreach ($value as $key2 =&gt; $value2) {
            $thisvb = (int) $key2;
            if ($thisvb == ($lastvb + 1)) { //This don't work
                echo '&lt;li&gt;';
            } else { echo '&lt;li value="' . $key2 . '"&gt;';}
            $last = (int) $key2;
            echo $voiceboxes[$key][$key2]['Title'] . "&lt;br/&gt;" . $voiceboxes[$key][$key2]['Link'] . '&lt;/li&gt;' . "\n";
            }
        }
    echo "&lt;/ol&gt;\n";
    echo '&lt;/ol&gt;';
?&gt;
</code></pre>

<p>This is what I get</p>

<pre><code>&lt;ol&gt;
&lt;ol&gt;
&lt;li&gt;Title2&lt;br/&gt;http://...&lt;/li&gt;
Title3&lt;br/&gt;http://...&lt;/li&gt; &lt;!-- this ain't right, it should start with &lt;li&gt; --&gt;
Title4&lt;br/&gt;http://...&lt;/li&gt; &lt;!-- same here --&gt;
&lt;/ol&gt;
&lt;/ol&gt;
</code></pre>

<p>I can't figure it out, does anyone know?</p>
