Which is the best way to remove middle element of associative array in PHP?
<p>Please tell me which is the best way to unset middle element of associative array in PHP?</p>

<p>Suppose I have an array of 10,000 elements and I want to remove middle element of that array, which is efficient way to remove middle element?</p>

<pre>
$temp = array('name1'=>'value1','name2'=>'value2',...,'name10000'=>'value10000');
$middleElem = ceil(count($temp) / 2);
$i = 0; 
foreach ($temp as $key=>$val) {
if ($i == $middleElem) {
 unset($temp[$key]);
 break; 
}
$i++;
}
</pre>

<p>Is above code efficient way?</p>
