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]; } return $string = $substr1 + $substr2; } reverse('12345');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OT1ST
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 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/OT1ST
function name:  reverse
number of ops:  21
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                                                      ->14
    7     8    >   SUB                                              ~11     !3, !4
          9        FETCH_DIM_R                                      ~12     !0, ~11
         10        ASSIGN_OP                                     1          !1, ~12
    8    11        FETCH_DIM_R                                      ~14     !0, !4
         12        ASSIGN_OP                                     1          !2, ~14
    6    13        PRE_INC                                                  !4
         14    >   DIV                                              ~17     !3, 2
         15        IS_SMALLER                                               !4, ~17
         16      > JMPNZ                                                    ~18, ->8
   10    17    >   ADD                                              ~19     !1, !2
         18        ASSIGN                                           ~20     !0, ~19
         19      > RETURN                                                   ~20
   11    20*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.09 ms | 1399 KiB | 14 Q