3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = array(); $values[0] = 5; $values[1] = 12; $values[2] = 19; $values[3] = 9; $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) . '\n'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 32
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 32
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 24
Branch analysis from position: 24
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/rcl0f
function name:  (null)
number of ops:  34
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
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  5
    4     3        ASSIGN_DIM                                               !0, 1
          4        OP_DATA                                                  12
    5     5        ASSIGN_DIM                                               !0, 2
          6        OP_DATA                                                  19
    6     7        ASSIGN_DIM                                               !0, 3
          8        OP_DATA                                                  9
    8     9        ASSIGN                                                   !1, !0
    9    10        INIT_FCALL                                               'rsort'
         11        SEND_REF                                                 !1
         12        DO_ICALL                                                 
   11    13      > FE_RESET_R                                       $13     !0, ->32
         14    > > FE_FETCH_R                                       ~14     $13, !2, ->32
         15    >   ASSIGN                                                   !3, ~14
   12    16      > FE_RESET_R                                       $16     !1, ->24
         17    > > FE_FETCH_R                                       ~17     $16, !4, ->24
         18    >   ASSIGN                                                   !5, ~17
   13    19        IS_IDENTICAL                                             !2, !4
         20      > JMPZ                                                     ~19, ->23
   14    21    >   ASSIGN                                                   !3, !5
   15    22      > JMP                                                      ->24
   12    23    > > JMP                                                      ->17
         24    >   FE_FREE                                                  $16
   18    25        CONCAT                                           ~21     !2, '-+Rank%3A+'
         26        CAST                                          4  ~22     !3
         27        ADD                                              ~23     ~22, 1
         28        CONCAT                                           ~24     ~21, ~23
         29        CONCAT                                           ~25     ~24, '%5Cn'
         30        ECHO                                                     ~25
   11    31      > JMP                                                      ->14
         32    >   FE_FREE                                                  $13
   19    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.67 ms | 1400 KiB | 15 Q