<?php
$user_scores = [
82 => ['score' => 1, 'time' => 6.442],
34 => ['score' => 1, 'time' => 5.646],
66 => ['score' => 3, 'time' => 1.554],
7 => ['score' => 2, 'time' => 4.442],
99 => ['score' => 4, 'time' => 3.646],
55 => ['score' => 1, 'time' => 2.554]
];
uasort($user_scores, function($a, $b) {
return [$b['score'], $a['time']]
<=>
[$a['score'], $b['time']];
});
var_export($user_scores);
- Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- array (
99 =>
array (
'score' => 4,
'time' => 3.646,
),
66 =>
array (
'score' => 3,
'time' => 1.554,
),
7 =>
array (
'score' => 2,
'time' => 4.442,
),
55 =>
array (
'score' => 1,
'time' => 2.554,
),
34 =>
array (
'score' => 1,
'time' => 5.646,
),
82 =>
array (
'score' => 1,
'time' => 6.442,
),
)
- Output for 7.0.0
- array (
99 =>
array (
'score' => 4,
'time' => 3.6459999999999999,
),
66 =>
array (
'score' => 3,
'time' => 1.554,
),
7 =>
array (
'score' => 2,
'time' => 4.4420000000000002,
),
55 =>
array (
'score' => 1,
'time' => 2.5539999999999998,
),
34 =>
array (
'score' => 1,
'time' => 5.6459999999999999,
),
82 =>
array (
'score' => 1,
'time' => 6.4420000000000002,
),
)
- Output for 5.6.40
- Parse error: syntax error, unexpected '>' in /in/HcqRK on line 14
Process exited with code 255.
preferences:
86.39 ms | 408 KiB | 5 Q