3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = array(); $values[0] = 5; $values[1] = 12; $values[2] = 19; $values[3] = 9; $values[4] = 5; $values[5] = 0; $values[6] = 0; $ordered_values = $values; rsort($ordered_values); foreach ($values as $key => $value) { foreach ($ordered_values as $ordered_key => $ordered_value) { if ($value === $ordered_value) { $key = $ordered_key; break; } } echo $value . '- Rank: ' . ((int) $key + 1) . '<br />'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 38
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 38
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 30
Branch analysis from position: 30
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/f3hM5
function name:  (null)
number of ops:  40
compiled vars:  !0 = $values, !1 = $ordered_values, !2 = $value, !3 = $key, !4 = $ordered_value, !5 = $ordered_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  5
    5     3        ASSIGN_DIM                                               !0, 1
          4        OP_DATA                                                  12
    6     5        ASSIGN_DIM                                               !0, 2
          6        OP_DATA                                                  19
    7     7        ASSIGN_DIM                                               !0, 3
          8        OP_DATA                                                  9
    8     9        ASSIGN_DIM                                               !0, 4
         10        OP_DATA                                                  5
    9    11        ASSIGN_DIM                                               !0, 5
         12        OP_DATA                                                  0
   10    13        ASSIGN_DIM                                               !0, 6
         14        OP_DATA                                                  0
   12    15        ASSIGN                                                   !1, !0
   13    16        INIT_FCALL                                               'rsort'
         17        SEND_REF                                                 !1
         18        DO_ICALL                                                 
   15    19      > FE_RESET_R                                       $16     !0, ->38
         20    > > FE_FETCH_R                                       ~17     $16, !2, ->38
         21    >   ASSIGN                                                   !3, ~17
   16    22      > FE_RESET_R                                       $19     !1, ->30
         23    > > FE_FETCH_R                                       ~20     $19, !4, ->30
         24    >   ASSIGN                                                   !5, ~20
   17    25        IS_IDENTICAL                                             !2, !4
         26      > JMPZ                                                     ~22, ->29
   18    27    >   ASSIGN                                                   !3, !5
   19    28      > JMP                                                      ->30
   16    29    > > JMP                                                      ->23
         30    >   FE_FREE                                                  $19
   22    31        CONCAT                                           ~24     !2, '-+Rank%3A+'
         32        CAST                                          4  ~25     !3
         33        ADD                                              ~26     ~25, 1
         34        CONCAT                                           ~27     ~24, ~26
         35        CONCAT                                           ~28     ~27, '%3Cbr+%2F%3E'
         36        ECHO                                                     ~28
   15    37      > JMP                                                      ->20
         38    >   FE_FREE                                                  $16
   23    39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.78 ms | 945 KiB | 16 Q