-
Notifications
You must be signed in to change notification settings - Fork 1
/
排序.php
18 lines (17 loc) · 849 Bytes
/
排序.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/*usort($ret,function($a,$b){
if($a['endTime']==0){
return 1;
}elseif($a['endTime']==$b['endTime']){
return 0;
}
return $a['endTime']<$b['endTime']?-1:1;
});*/
//$byEndTime=array_map(function($element) {return ($element['endTime']==0)?PHP_INT_MAX:$element['endTime'];}, $ret);//array_column
//$byAmount=array_map(function($element) {return $element['amount'];}, $ret);//array_column
foreach($ret as $k => $v){
$byEndTime[$k]=$v['endTime'];
$byWithdraw[$k]=$v['canWithdraw'];
$byAmount[$k]=$v['amount'];
}
array_multisort($byEndTime,SORT_ASC,$byWithdraw,SORT_ASC,$byAmount,SORT_ASC,$ret);//升序,0最大