3v4l.org

run code in 300+ PHP versions simultaneously
<?php // assumed already rsort()ed. $scores = [92, 84, 84, 84, 83, 65, 41, 38, 38, 37]; $gappedRank = 0; $result = []; foreach ($scores as $score) { ++$gappedRank; $gappedRanks[$score] ??= $gappedRank; $result[] = [$score => $gappedRanks[$score]]; } var_export($result);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
array ( 0 => array ( 92 => 1, ), 1 => array ( 84 => 2, ), 2 => array ( 84 => 2, ), 3 => array ( 84 => 2, ), 4 => array ( 83 => 5, ), 5 => array ( 65 => 6, ), 6 => array ( 41 => 7, ), 7 => array ( 38 => 8, ), 8 => array ( 38 => 8, ), 9 => array ( 37 => 10, ), )

preferences:
109.52 ms | 403 KiB | 91 Q