3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse3($arr) { $len = count($arr); for ($i = 0; $i < $len/2; ++$i) { $place = $len - 1 - $i; $tmp = $arr[$place]; $arr[$place] = $arr[$i]; $arr[$i] = $tmp; } return $arr; } var_dump(reverse2(array(1,2,3)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4UVMC
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL_BY_NAME                                       'reverse2'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function reverse3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/4UVMC
function name:  reverse3
number of ops:  21
compiled vars:  !0 = $arr, !1 = $len, !2 = $i, !3 = $place, !4 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        COUNT                                            ~5      !0
          2        ASSIGN                                                   !1, ~5
    5     3        ASSIGN                                                   !2, 0
          4      > JMP                                                      ->16
    6     5    >   SUB                                              ~8      !1, 1
          6        SUB                                              ~9      ~8, !2
          7        ASSIGN                                                   !3, ~9
    7     8        FETCH_DIM_R                                      ~11     !0, !3
          9        ASSIGN                                                   !4, ~11
    8    10        FETCH_DIM_R                                      ~14     !0, !2
         11        ASSIGN_DIM                                               !0, !3
         12        OP_DATA                                                  ~14
    9    13        ASSIGN_DIM                                               !0, !2
         14        OP_DATA                                                  !4
    5    15        PRE_INC                                                  !2
         16    >   DIV                                              ~17     !1, 2
         17        IS_SMALLER                                               !2, ~17
         18      > JMPNZ                                                    ~18, ->5
   11    19    > > RETURN                                                   !0
   12    20*     > RETURN                                                   null

End of function reverse3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.96 ms | 1388 KiB | 15 Q