3v4l.org

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

End of function reverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.85 ms | 1394 KiB | 18 Q