3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string)-1; for ($i = 0; $i < ($strLength / 2); $i++) { $substr1[] += $string[$strLength-$i]; $substr2[] += $string[$i]; } //var_dump($substr1); //var_dump($substr2); return $string = $substr1 + $substr2; } var_dump(reverse('12345'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/geGtr
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'reverse'
          2        SEND_VAL                                                 '12345'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 8
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 8
Branch analysis from position: 19
Branch analysis from position: 8
filename:       /in/geGtr
function name:  reverse
number of ops:  23
compiled vars:  !0 = $string, !1 = $substr1, !2 = $substr2, !3 = $strLength, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, ''
    5     3        STRLEN                                           ~7      !0
          4        SUB                                              ~8      ~7, 1
          5        ASSIGN                                                   !3, ~8
    6     6        ASSIGN                                                   !4, 0
          7      > JMP                                                      ->16
    7     8    >   SUB                                              ~12     !3, !4
          9        FETCH_DIM_R                                      ~13     !0, ~12
         10        ASSIGN_DIM_OP                +=               1          !1
         11        OP_DATA                                                  ~13
    8    12        FETCH_DIM_R                                      ~15     !0, !4
         13        ASSIGN_DIM_OP                +=               1          !2
         14        OP_DATA                                                  ~15
    6    15        PRE_INC                                                  !4
         16    >   DIV                                              ~17     !3, 2
         17        IS_SMALLER                                               !4, ~17
         18      > JMPNZ                                                    ~18, ->8
   12    19    >   ADD                                              ~19     !1, !2
         20        ASSIGN                                           ~20     !0, ~19
         21      > RETURN                                                   ~20
   13    22*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.59 ms | 1390 KiB | 16 Q