3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = []; const ITERATIONS = 100000; $start = microtime(true); for ($i = 0; $i < ITERATIONS; $i++) { strtr('1_000_000', ['_' => '']); strtr('1000000', ['_' => '']); } $values['strtr'] = microtime(true) - $start; $start = microtime(true); for ($i = 0; $i < ITERATIONS; $i++) { str_replace('_', '', '1_000_000'); str_replace('_', '', '1000000'); } $values['str_replace'] = (microtime(true) - $start); asort($values); echo array_key_first($values). "\n"; foreach ($values as $key => $val) { // echo "\n".str_pad($key, 14, ' ') . number_format($val * 1000 / ITERATIONS, 5) . " ms / k"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 32
Branch analysis from position: 46
2 jumps found. (Code = 77) Position 1 = 61, Position 2 = 64
Branch analysis from position: 61
2 jumps found. (Code = 78) Position 1 = 62, Position 2 = 64
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 32
Branch analysis from position: 46
Branch analysis from position: 32
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
Branch analysis from position: 8
filename:       /in/RQ4tb
function name:  (null)
number of ops:  66
compiled vars:  !0 = $values, !1 = $start, !2 = $i, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        DECLARE_CONST                                            'ITERATIONS', 100000
    7     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    8     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->17
    9     8    >   INIT_FCALL                                               'strtr'
          9        SEND_VAL                                                 '1_000_000'
         10        SEND_VAL                                                 <array>
         11        DO_ICALL                                                 
   10    12        INIT_FCALL                                               'strtr'
         13        SEND_VAL                                                 '1000000'
         14        SEND_VAL                                                 <array>
         15        DO_ICALL                                                 
    8    16        PRE_INC                                                  !2
         17    >   FETCH_CONSTANT                                   ~12     'ITERATIONS'
         18        IS_SMALLER                                               !2, ~12
         19      > JMPNZ                                                    ~13, ->8
   12    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $15     
         23        SUB                                              ~16     $15, !1
         24        ASSIGN_DIM                                               !0, 'strtr'
         25        OP_DATA                                                  ~16
   14    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $17     
         29        ASSIGN                                                   !1, $17
   15    30        ASSIGN                                                   !2, 0
         31      > JMP                                                      ->43
   16    32    >   INIT_FCALL                                               'str_replace'
         33        SEND_VAL                                                 '_'
         34        SEND_VAL                                                 ''
         35        SEND_VAL                                                 '1_000_000'
         36        DO_ICALL                                                 
   17    37        INIT_FCALL                                               'str_replace'
         38        SEND_VAL                                                 '_'
         39        SEND_VAL                                                 ''
         40        SEND_VAL                                                 '1000000'
         41        DO_ICALL                                                 
   15    42        PRE_INC                                                  !2
         43    >   FETCH_CONSTANT                                   ~23     'ITERATIONS'
         44        IS_SMALLER                                               !2, ~23
         45      > JMPNZ                                                    ~24, ->32
   19    46    >   INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $26     
         49        SUB                                              ~27     $26, !1
         50        ASSIGN_DIM                                               !0, 'str_replace'
         51        OP_DATA                                                  ~27
   21    52        INIT_FCALL                                               'asort'
         53        SEND_REF                                                 !0
         54        DO_ICALL                                                 
   23    55        INIT_FCALL                                               'array_key_first'
         56        SEND_VAR                                                 !0
         57        DO_ICALL                                         $29     
         58        CONCAT                                           ~30     $29, '%0A'
         59        ECHO                                                     ~30
   25    60      > FE_RESET_R                                       $31     !0, ->64
         61    > > FE_FETCH_R                                       ~32     $31, !3, ->64
         62    >   ASSIGN                                                   !4, ~32
         63      > JMP                                                      ->61
         64    >   FE_FREE                                                  $31
   27    65      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.68 ms | 1009 KiB | 18 Q