3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = '/some/path/'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { if (substr( $path, -1 ) == '/') $path = substr( $path, 0, -1 ); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { if (substr( $path, -1 ) == '/') $path = substr( $path, 0, -1 ); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path/'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $path = rtrim($path, '/'); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $path = rtrim($path, '/'); } $end = microtime(true); echo "<br>\n" . $end - $start;
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 = 22, Position 2 = 7
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 36
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 73, Position 2 = 65
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 93
Branch analysis from position: 93
2 jumps found. (Code = 44) Position 1 = 95, Position 2 = 87
Branch analysis from position: 95
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
2 jumps found. (Code = 44) Position 1 = 95, Position 2 = 87
Branch analysis from position: 95
Branch analysis from position: 87
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 73, Position 2 = 65
Branch analysis from position: 73
Branch analysis from position: 65
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 48
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 36
Branch analysis from position: 51
Branch analysis from position: 36
Branch analysis from position: 48
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 7
Branch analysis from position: 22
Branch analysis from position: 7
Branch analysis from position: 19
filename:       /in/6ge3Y
function name:  (null)
number of ops:  103
compiled vars:  !0 = $path, !1 = $start, !2 = $i, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fsome%2Fpath%2F'
    5     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    7     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->20
    8     7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 -1
         10        DO_ICALL                                         $8      
         11        IS_EQUAL                                                 $8, '%2F'
         12      > JMPZ                                                     ~9, ->19
         13    >   INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 0
         16        SEND_VAL                                                 -1
         17        DO_ICALL                                         $10     
         18        ASSIGN                                                   !0, $10
    7    19    >   PRE_INC                                                  !2
         20    >   IS_SMALLER                                               !2, 10000
         21      > JMPNZ                                                    ~13, ->7
   11    22    >   INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $14     
         25        ASSIGN                                                   !3, $14
   13    26        SUB                                              ~16     !3, !1
         27        CONCAT                                           ~17     '%3Cbr%3E%0A', ~16
         28        ECHO                                                     ~17
   15    29        ASSIGN                                                   !0, '%2Fsome%2Fpath'
   17    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $19     
         33        ASSIGN                                                   !1, $19
   19    34        ASSIGN                                                   !2, 0
         35      > JMP                                                      ->49
   20    36    >   INIT_FCALL                                               'substr'
         37        SEND_VAR                                                 !0
         38        SEND_VAL                                                 -1
         39        DO_ICALL                                         $22     
         40        IS_EQUAL                                                 $22, '%2F'
         41      > JMPZ                                                     ~23, ->48
         42    >   INIT_FCALL                                               'substr'
         43        SEND_VAR                                                 !0
         44        SEND_VAL                                                 0
         45        SEND_VAL                                                 -1
         46        DO_ICALL                                         $24     
         47        ASSIGN                                                   !0, $24
   19    48    >   PRE_INC                                                  !2
         49    >   IS_SMALLER                                               !2, 10000
         50      > JMPNZ                                                    ~27, ->36
   23    51    >   INIT_FCALL                                               'microtime'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $28     
         54        ASSIGN                                                   !3, $28
   25    55        SUB                                              ~30     !3, !1
         56        CONCAT                                           ~31     '%3Cbr%3E%0A', ~30
         57        ECHO                                                     ~31
   27    58        ASSIGN                                                   !0, '%2Fsome%2Fpath%2F'
   29    59        INIT_FCALL                                               'microtime'
         60        SEND_VAL                                                 <true>
         61        DO_ICALL                                         $33     
         62        ASSIGN                                                   !1, $33
   31    63        ASSIGN                                                   !2, 0
         64      > JMP                                                      ->71
   32    65    >   INIT_FCALL                                               'rtrim'
         66        SEND_VAR                                                 !0
         67        SEND_VAL                                                 '%2F'
         68        DO_ICALL                                         $36     
         69        ASSIGN                                                   !0, $36
   31    70        PRE_INC                                                  !2
         71    >   IS_SMALLER                                               !2, 10000
         72      > JMPNZ                                                    ~39, ->65
   35    73    >   INIT_FCALL                                               'microtime'
         74        SEND_VAL                                                 <true>
         75        DO_ICALL                                         $40     
         76        ASSIGN                                                   !3, $40
   37    77        SUB                                              ~42     !3, !1
         78        CONCAT                                           ~43     '%3Cbr%3E%0A', ~42
         79        ECHO                                                     ~43
   39    80        ASSIGN                                                   !0, '%2Fsome%2Fpath'
   41    81        INIT_FCALL                                               'microtime'
         82        SEND_VAL                                                 <true>
         83        DO_ICALL                                         $45     
         84        ASSIGN                                                   !1, $45
   43    85        ASSIGN                                                   !2, 0
         86      > JMP                                                      ->93
   44    87    >   INIT_FCALL                                               'rtrim'
         88        SEND_VAR                                                 !0
         89        SEND_VAL                                                 '%2F'
         90        DO_ICALL                                         $48     
         91        ASSIGN                                                   !0, $48
   43    92        PRE_INC                                                  !2
         93    >   IS_SMALLER                                               !2, 10000
         94      > JMPNZ                                                    ~51, ->87
   47    95    >   INIT_FCALL                                               'microtime'
         96        SEND_VAL                                                 <true>
         97        DO_ICALL                                         $52     
         98        ASSIGN                                                   !3, $52
   49    99        SUB                                              ~54     !3, !1
        100        CONCAT                                           ~55     '%3Cbr%3E%0A', ~54
        101        ECHO                                                     ~55
        102      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.37 ms | 1396 KiB | 19 Q