3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path1 = 'C:\Winwdows\system32\drivers\etc'; $path2 = '/foo/bar/sub/home'; $startTime = microtime(true); for ($i = 0; $i < 1000000, $i++;) { strtr($path1, '\\', '/'); strtr($path2, '\\', '/'); } echo number_format(( (microtime(true) - $startTime) * 1000), 4) . " ms (strtr)\n"; $startTime = microtime(true); for ($i = 0; $i < 1000000, $i++;) { str_replace('\\', '/', $path1); str_replace('\\', '/', $path2); } echo number_format(( (microtime(true) - $startTime) * 1000), 4) . " ms (str_replace) \n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 8
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 = 53, Position 2 = 39
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 39
Branch analysis from position: 53
Branch analysis from position: 39
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 8
Branch analysis from position: 22
Branch analysis from position: 8
filename:       /in/MNrgC
function name:  (null)
number of ops:  65
compiled vars:  !0 = $path1, !1 = $path2, !2 = $startTime, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'C%3A%5CWinwdows%5Csystem32%5Cdrivers%5Cetc'
    4     1        ASSIGN                                                   !1, '%2Ffoo%2Fbar%2Fsub%2Fhome'
    6     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
    8     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->18
    9     8    >   INIT_FCALL                                               'strtr'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 '%5C'
         11        SEND_VAL                                                 '%2F'
         12        DO_ICALL                                                 
   10    13        INIT_FCALL                                               'strtr'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 '%5C'
         16        SEND_VAL                                                 '%2F'
         17        DO_ICALL                                                 
    8    18    >   IS_SMALLER                                       ~11     !3, 1000000
         19        FREE                                                     ~11
         20        POST_INC                                         ~12     !3
         21      > JMPNZ                                                    ~12, ->8
   13    22    >   INIT_FCALL                                               'number_format'
         23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $13     
         26        SUB                                              ~14     $13, !2
         27        MUL                                              ~15     ~14, 1000
         28        SEND_VAL                                                 ~15
         29        SEND_VAL                                                 4
         30        DO_ICALL                                         $16     
         31        CONCAT                                           ~17     $16, '+ms+%28strtr%29%0A'
         32        ECHO                                                     ~17
   15    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $18     
         36        ASSIGN                                                   !2, $18
   17    37        ASSIGN                                                   !3, 0
         38      > JMP                                                      ->49
   18    39    >   INIT_FCALL                                               'str_replace'
         40        SEND_VAL                                                 '%5C'
         41        SEND_VAL                                                 '%2F'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                                 
   19    44        INIT_FCALL                                               'str_replace'
         45        SEND_VAL                                                 '%5C'
         46        SEND_VAL                                                 '%2F'
         47        SEND_VAR                                                 !1
         48        DO_ICALL                                                 
   17    49    >   IS_SMALLER                                       ~23     !3, 1000000
         50        FREE                                                     ~23
         51        POST_INC                                         ~24     !3
         52      > JMPNZ                                                    ~24, ->39
   22    53    >   INIT_FCALL                                               'number_format'
         54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $25     
         57        SUB                                              ~26     $25, !2
         58        MUL                                              ~27     ~26, 1000
         59        SEND_VAL                                                 ~27
         60        SEND_VAL                                                 4
         61        DO_ICALL                                         $28     
         62        CONCAT                                           ~29     $28, '+ms+%28str_replace%29+%0A'
         63        ECHO                                                     ~29
         64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.04 ms | 1400 KiB | 21 Q