3v4l.org

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

Function reverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
Branch analysis from position: 7
filename:       /in/u7FF8
function name:  reverse
number of ops:  20
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        ASSIGN                                                   !3, ~7
    6     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->13
    7     7    >   SUB                                              ~10     !3, !4
          8        FETCH_DIM_R                                      ~11     !0, ~10
          9        ASSIGN_OP                                     1          !1, ~11
    8    10        FETCH_DIM_R                                      ~13     !0, !4
         11        ASSIGN_OP                                     1          !2, ~13
    6    12        PRE_INC                                                  !4
         13    >   DIV                                              ~16     !3, 2
         14        IS_SMALLER                                               !4, ~16
         15      > JMPNZ                                                    ~17, ->7
   10    16    >   ADD                                              ~18     !1, !2
         17        ASSIGN                                           ~19     !0, ~18
         18      > RETURN                                                   ~19
   11    19*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.3 ms | 1399 KiB | 14 Q