3v4l.org

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

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.15 ms | 1403 KiB | 18 Q