Perf: Little speed enhancement

This commit is contained in:
Laurent Destailleur 2011-08-29 21:06:00 +00:00
parent 9a7e46203e
commit 9c78691199

View File

@ -3915,7 +3915,8 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive
// Clean parameters // Clean parameters
$order=strtolower($order); $order=strtolower($order);
if (is_array($array) && count($array)>0) $sizearray=count($array);
if (is_array($array) && $sizearray>0)
{ {
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);