Most efficient way to empty an array
<p>I have an array containing several keys, values, objects etc.. I need to empty that array but I'd like to do it in the most efficient manner.</p>

<p>The best I can come up with is:</p>

<pre><code>foreach ($array as $key =&gt; $val) unset($array[$key]);
</code></pre>

<p>But I don't like the idea of having to loop through the array to just empty it.. surely there's a nice slick/clever way of doing this without wasting memory creating a new array?</p>

<p>Note: I'm not sure myself if it does cost extra memory in creating the array as new again. If it doesn't then $array = new array(); would be a fine way of 'emptying' it.</p>
