php delete array elements inside foreach loop?
<p>I have a foreach loop and I would like to completely remove the array elements that satisfy the criteria and change the keys to stay 1,2,3,4.</p>

<p>I have:</p>

<pre><code>$thearray=array(20,1,15,12,3,6,93);
foreach($thearray as $key=&gt;$value){
    if($value&lt;10){
        unset($thearray[$key]);
    }
}
print_r($thearray);
</code></pre>

<p>But this keeps the keys as they were before...I want to make them 1,2,3,4...how to do?</p>
