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++) { var_dump($strLength-$i); var_dump($strLength / 2-$i); $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLength / 2 - $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/Ur266
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     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 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
Branch analysis from position: 7
filename:       /in/Ur266
function name:  reverse
number of ops:  31
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                                                      ->24
    7     7    >   INIT_FCALL                                               'var_dump'
          8        SUB                                              ~10     !3, !4
          9        SEND_VAL                                                 ~10
         10        DO_ICALL                                                 
    8    11        INIT_FCALL                                               'var_dump'
         12        DIV                                              ~12     !3, 2
         13        SUB                                              ~13     ~12, !4
         14        SEND_VAL                                                 ~13
         15        DO_ICALL                                                 
    9    16        SUB                                              ~15     !3, !4
         17        FETCH_DIM_R                                      ~16     !0, ~15
         18        ASSIGN_OP                                     8          !1, ~16
   10    19        DIV                                              ~18     !3, 2
         20        SUB                                              ~19     ~18, !4
         21        FETCH_DIM_R                                      ~20     !0, ~19
         22        ASSIGN_OP                                     8          !2, ~20
    6    23        PRE_INC                                                  !4
         24    >   DIV                                              ~23     !3, 2
         25        IS_SMALLER                                               !4, ~23
         26      > JMPNZ                                                    ~24, ->7
   14    27    >   CONCAT                                           ~25     !1, !2
         28        ASSIGN                                           ~26     !0, ~25
         29      > RETURN                                                   ~26
   15    30*     > RETURN                                                   null

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.47 ms | 1402 KiB | 16 Q