MDL-33635 improve collatorlib::ksort() coding style and perf

Thanks Eloy Lafuente for spotting my sloppy coding style!
This commit is contained in:
Petr Skoda
2012-06-13 16:37:56 +02:00
parent b71d0b43fc
commit bc53b4e9d7
2 changed files with 15 additions and 4 deletions
+1 -4
View File
@@ -872,10 +872,7 @@ class collatorlib {
}
// This is a bit slow, but we need to keep the references
$original = $arr;
$count = count($arr);
for($i=0; $i<$count; $i++) {
array_pop($arr);
}
$arr = array(); // Surprisingly this does not break references outside
foreach ($keys as $key) {
$arr[$key] = $original[$key];
}