3v4l.org

run code in 300+ PHP versions simultaneously
<?php function swapOutermost(&$a) { if(count($a) < 2){ return; } $len = count($a); $temp = $a[0]; $a[0] = $a[$len - 1]; $a[$len - 1] = $temp; swapOutermost(array_slice($a, 1, $len - 2)); } $array = [1, 2, 3, 4, 5, 6, 7]; swapOutermost($array); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CT5QZ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'swapoutermost'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   16     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function swapoutermost:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CT5QZ
function name:  swapOutermost
number of ops:  26
compiled vars:  !0 = $a, !1 = $len, !2 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        COUNT                                            ~3      !0
          2        IS_SMALLER                                               ~3, 2
          3      > JMPZ                                                     ~4, ->5
    5     4    > > RETURN                                                   null
    7     5    >   COUNT                                            ~5      !0
          6        ASSIGN                                                   !1, ~5
    8     7        FETCH_DIM_R                                      ~7      !0, 0
          8        ASSIGN                                                   !2, ~7
    9     9        SUB                                              ~10     !1, 1
         10        FETCH_DIM_R                                      ~11     !0, ~10
         11        ASSIGN_DIM                                               !0, 0
         12        OP_DATA                                                  ~11
   10    13        SUB                                              ~12     !1, 1
         14        ASSIGN_DIM                                               !0, ~12
         15        OP_DATA                                                  !2
   11    16        INIT_FCALL_BY_NAME                                       'swapOutermost'
         17        INIT_FCALL                                               'array_slice'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 1
         20        SUB                                              ~14     !1, 2
         21        SEND_VAL                                                 ~14
         22        DO_ICALL                                         $15     
         23        SEND_VAR_NO_REF_EX                                       $15
         24        DO_FCALL                                      0          
   12    25      > RETURN                                                   null

End of function swapoutermost

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
254.91 ms | 1004 KiB | 16 Q