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; $lookup = []; foreach ($scores as $score) { ++$gappedRank; $lookup[$score] ??= $gappedRank; } var_export($lookup);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/3ti7N
function name:  (null)
number of ops:  18
compiled vars:  !0 = $scores, !1 = $gappedRank, !2 = $lookup, !3 = $score
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 0
    7     2        ASSIGN                                                   !2, <array>
    8     3      > FE_RESET_R                                       $7      !0, ->13
          4    > > FE_FETCH_R                                               $7, !3, ->13
    9     5    >   PRE_INC                                                  !1
   10     6        FETCH_DIM_IS                                     ~9      !2, !3
          7        COALESCE                                         ~10     ~9
          8        ASSIGN_DIM                                       ~11     !2, !3
          9        OP_DATA                                                  !1
         10        QM_ASSIGN                                        ~10     ~11
         11        FREE                                                     ~10
    8    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $7
   12    14        INIT_FCALL                                               'var_export'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.23 ms | 1436 KiB | 14 Q