3v4l.org

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

Function customreverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
Branch analysis from position: 6
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
Branch analysis from position: 6
filename:       /in/LjRJD
function name:  customReverse
number of ops:  25
compiled vars:  !0 = $array, !1 = $reversedArray, !2 = $count, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <array>
    7     2        COUNT                                            ~5      !0
          3        ASSIGN                                                   !2, ~5
    8     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->20
    9     6    >   MOD                                              ~9      !3, 2
          7        IS_IDENTICAL                                             ~9, 0
          8      > JMPZ                                                     ~10, ->13
          9    >   DIV                                              ~11     !3, 2
         10        FETCH_DIM_R                                      ~12     !0, ~11
         11        QM_ASSIGN                                        ~13     ~12
         12      > JMP                                                      ->17
         13    >   DIV                                              ~14     !3, 2
         14        SUB                                              ~15     !2, ~14
         15        FETCH_DIM_R                                      ~16     !0, ~15
         16        QM_ASSIGN                                        ~13     ~16
         17    >   ASSIGN_DIM                                               !1
         18        OP_DATA                                                  ~13
    8    19        PRE_INC                                                  !3
         20    >   COUNT                                            ~18     !0
         21        IS_SMALLER                                               !3, ~18
         22      > JMPNZ                                                    ~19, ->6
   11    23    > > RETURN                                                   !1
   12    24*     > RETURN                                                   null

End of function customreverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.17 ms | 1007 KiB | 15 Q