summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/arrayutil.inc.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/inc/arrayutil.inc.php b/inc/arrayutil.inc.php
index c1306ac7..3beceb41 100644
--- a/inc/arrayutil.inc.php
+++ b/inc/arrayutil.inc.php
@@ -36,4 +36,16 @@ class ArrayUtil
return $out;
}
+ /**
+ * Sort array by given column.
+ * @param array $array
+ * @param string $column
+ * @return void
+ */
+ public static function sortByColumn(array &$array, string $column, int $sortFlags = SORT_REGULAR)
+ {
+ $sorter = array_column($array, $column);
+ array_multisort($sorter, $sortFlags, $array);
+ }
+
} \ No newline at end of file