3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rotor = ["A" => "R", "B" => "D", "C" => "O", "D" => "B"]; $from = "C"; foreach (array_keys($rotor) as $index => $key) { if ($key === $from) { $rotor = array_slice($rotor, $index, null, true) + $rotor; break; } } var_export($rotor);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
Branch analysis from position: 20
filename:       /in/1lFTE
function name:  (null)
number of ops:  25
compiled vars:  !0 = $rotor, !1 = $from, !2 = $key, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'C'
    6     2        INIT_FCALL                                               'array_keys'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5      > FE_RESET_R                                       $7      $6, ->20
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->20
          7    >   ASSIGN                                                   !3, ~8
    7     8        IS_IDENTICAL                                             !2, !1
          9      > JMPZ                                                     ~10, ->19
    8    10    >   INIT_FCALL                                               'array_slice'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 null
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        ADD                                              ~12     $11, !0
         17        ASSIGN                                                   !0, ~12
    9    18      > JMP                                                      ->20
    6    19    > > JMP                                                      ->6
         20    >   FE_FREE                                                  $7
   12    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.85 ms | 1000 KiB | 16 Q