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 git.master, git.master_jit, rfc.property-hooks
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, ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.7 ms | 410 KiB | 6 Q