We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
array_order_by
1 parent 9024948 commit 943af6fCopy full SHA for 943af6f
src/array.php
@@ -16,3 +16,25 @@ function array_except_value(array $array, $value)
16
return $array;
17
}
18
19
+
20
+if (!function_exists('array_order_by')) {
21
+ function array_order_by(array $array, $field1 = null, $sort1 = null, $_ = null)
22
+ {
23
+ $args = func_get_args();
24
25
+ $data = array_shift($args);
26
+ foreach ($args as $argKey => $argValue) {
27
+ if (is_string($argValue)) {
28
+ $column = [];
29
+ foreach ($data as $key => $item) {
30
+ $column[$key] = $item[$argValue];
31
+ }
32
+ $args[$argKey] = $column;
33
34
35
+ $args[] = &$data;
36
+ call_user_func_array('array_multisort', $args);
37
38
+ return array_pop($args);
39
40
+}
0 commit comments