How to reset keys after unsetting values in an array? : <p>Take the following array:</p>

<pre><code>$fruits = [
    'apple', 'banana', 'grapefruit', 'orange', 'melon'
];
</code></pre>

<p>Grapefruits are just disgusting, so I would like to unset it.</p>

<pre><code>$key = array_search('grapefruit', $fruit);
unset($fruit[$key]);
</code></pre>

<p>The grapefruit is out of my <code>$fruit</code> array but my keys are no longer numbered correctly.</p>

<pre><code>array(4) {
    [0] =&gt; 'apple'
    [1] =&gt; 'banana'
    [3] =&gt; 'orange'
    [4] =&gt; 'melon'
}
</code></pre>

<p>I Could loop through the array and create a new one but I was wondering if there's a simpler method to reset the keys.</p>
