3v4l.org

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

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

End of function reversearray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.23 ms | 1003 KiB | 15 Q