-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_array.php
More file actions
48 lines (42 loc) · 1005 Bytes
/
Copy pathexample_array.php
File metadata and controls
48 lines (42 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
$collection = [
[
'anyTypeSort' => '3',
'matchQuality' => '500',
'objectName' => 'FooA'
],
[
'anyTypeSort' => '4',
'matchQuality' => '600',
'objectName' => 'FooB'
],
[
'anyTypeSort' => '2',
'matchQuality' => '700',
'objectName' => 'FooC'
],
[
'anyTypeSort' => '3',
'matchQuality' => '800',
'objectName' => 'FooE'
],
[
'anyTypeSort' => '1',
'matchQuality' => '900',
'objectName' => 'FooF'
],
[
'anyTypeSort' => '3',
'matchQuality' => '800',
'objectName' => 'FooG'
]
];
$sortedPropertiesDirections = [
'anyTypeSort' => SORT_NUMERIC,
'matchQuality' => SORT_DESC,
'objectName' => SORT_ASC
];
$arraySorter = new \JanMaennig\Sorty\ArrayValueSorter();
$result = $arraySorter->sorting($collection, $sortedPropertiesDirections);
print_r($result);