Rebase array keys after unsetting elements
<p>I have an array:</p>

<pre><code>$array = array(1,2,3,4,5);
</code></pre>

<p>If I were to dump the contents of the array they would look like this:</p>

<pre><code>array(5) {
  [0] =&gt; int(1)
  [1] =&gt; int(2)
  [2] =&gt; int(3)
  [3] =&gt; int(4)
  [4] =&gt; int(5)
}
</code></pre>

<p>When I loop through and unset certain keys, the index gets all jacked up. </p>

<pre><code>foreach($array as $i =&gt; $info)
{
  if($info == 1 || $info == 2)
  {
    unset($array[$i]);
  }
}
</code></pre>

<p>Subsequently, if I did another dump now it would look like: </p>

<pre><code>array(3) {
  [2] =&gt; int(3)
  [3] =&gt; int(4)
  [4] =&gt; int(5)
}
</code></pre>

<p>Is there a proper way to reset the array so it's elements are Zero based again ?? </p>

<pre><code>array(3) {
  [0] =&gt; int(3)
  [1] =&gt; int(4)
  [2] =&gt; int(5)
}
</code></pre>
