3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['orange', 'foo', 'bar']; function reverse(array $a) { $reversed = array(); $length = count($a) - 1; for ($i = $length; $i >=0; $i--) { $reversed[] = $a[$i]; } return $reversed; } var_dump(reverse($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sCq2n
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'reverse'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/sCq2n
function name:  reverse
number of ops:  15
compiled vars:  !0 = $a, !1 = $reversed, !2 = $length, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <array>
    9     2        COUNT                                            ~5      !0
          3        SUB                                              ~6      ~5, 1
          4        ASSIGN                                                   !2, ~6
   11     5        ASSIGN                                                   !3, !2
          6      > JMP                                                      ->11
   12     7    >   FETCH_DIM_R                                      ~10     !0, !3
          8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  ~10
   11    10        PRE_DEC                                                  !3
         11    >   IS_SMALLER_OR_EQUAL                                      0, !3
         12      > JMPNZ                                                    ~12, ->7
   14    13    > > RETURN                                                   !1
   15    14*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.65 ms | 1398 KiB | 16 Q