3v4l.org

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

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.23 ms | 1403 KiB | 18 Q