compareValues($va, $vb, $type); if ($result !== 0) { return $order ? $result : -$result; } } return 0; }); return $array; } /** * Compare two values using the sort type expected by sorte(). */ private function compareValues($a, $b, $type) { switch ($type) { case 1: // Case insensitive natural return strnatcasecmp((string)$a, (string)$b); case 2: // Numeric return ($a == $b) ? 0 : (($a < $b) ? -1 : 1); case 3: // Case sensitive string return strcmp((string)$a, (string)$b); case 4: // Case insensitive string return strcasecmp((string)$a, (string)$b); default: // Case sensitive natural return strnatcmp((string)$a, (string)$b); } } } $multisort = new multiSort(); ?>