function
arraySort(
$arr
,
$keys
,
$type
=
'asc'
) {
code
$keysvalue
=
$new_array
=
array
();
io
foreach
(
$arr
as
$k
=>
$v
){
function
$keysvalue
[
$k
] =
$v
[
$keys
];
foreach
}
im
$type
==
'asc'
? asort(
$keysvalue
) : arsort(
$keysvalue
);
sort
reset(
$keysvalue
);
co
foreach
(
$keysvalue
as
$k
=>
$v
) {
time
$new_array
[
$k
] =
$arr
[
$k
];
new
}
return
return
$new_array
;
}
$arr
[] =
array
(
"name"
=>
"1"
,
"time"
=>1) ;
$arr
[] =
array
(
"name"
=>
"2"
,
"time"
=>2);
arraySort(
$arr
,
"time"
,
"desc"
);