3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Function to reverse $arr from start to end*/ function reverseArray(&$arr, $start=0): void { $end = count($arr)-1; while ($start < $end) { [$arr[$start],$arr[$end]] = [$arr[$end],$arr[$start]]; $start++; $end--; } } $a = [1,2,3,4]; reverseArray($a); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8VjtZ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'reversearray'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   19     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

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

End of function reversearray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.69 ms | 1403 KiB | 16 Q