3v4l.org

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

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.4 ms | 1403 KiB | 18 Q