3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; for ($i = 0; $i < (strlen($string) / 2); $i++) { $substr1 += $string[strlen($string)-$i]; $substr2 += $string[$i]; } return $string = $substr1 + $string2; } reverse('12345');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sq6jB
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     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 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
Branch analysis from position: 5
filename:       /in/sq6jB
function name:  reverse
number of ops:  20
compiled vars:  !0 = $string, !1 = $substr1, !2 = $substr2, !3 = $i, !4 = $string2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, ''
    5     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->12
    6     5    >   STRLEN                                           ~8      !0
          6        SUB                                              ~9      ~8, !3
          7        FETCH_DIM_R                                      ~10     !0, ~9
          8        ASSIGN_OP                                     1          !1, ~10
    7     9        FETCH_DIM_R                                      ~12     !0, !3
         10        ASSIGN_OP                                     1          !2, ~12
    5    11        PRE_INC                                                  !3
         12    >   STRLEN                                           ~15     !0
         13        DIV                                              ~16     ~15, 2
         14        IS_SMALLER                                               !3, ~16
         15      > JMPNZ                                                    ~17, ->5
    9    16    >   ADD                                              ~18     !1, !4
         17        ASSIGN                                           ~19     !0, ~18
         18      > RETURN                                                   ~19
   10    19*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.05 ms | 1398 KiB | 14 Q