3v4l.org

run code in 300+ PHP versions simultaneously
<?php define ('BENCHMARK_ITERATIONS', 1000); $r = microtime(1); for ($i = 0; $i < BENCHMARK_ITERATIONS; $i++) { preg_match('/([0-9]+)USD(.+)/', 'DATA-THAT-SHOULD-BE-REMOVED-@##($(@# 89USD', $matches); } var_dump(microtime(1) - $r); $r = microtime(1); for ($i = 0; $i < BENCHMARK_ITERATIONS; $i++) { substr('DATA-THAT-SHOULD-BE-REMOVED-@##($(@# 89USD', 36); } var_dump(microtime(1) - $r);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 10
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 32
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 32
Branch analysis from position: 40
Branch analysis from position: 32
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 10
Branch analysis from position: 19
Branch analysis from position: 10
filename:       /in/NFZ5g
function name:  (null)
number of ops:  48
compiled vars:  !0 = $r, !1 = $i, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'BENCHMARK_ITERATIONS'
          2        SEND_VAL                                                 1000
          3        DO_ICALL                                                 
    5     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !0, $4
    7     8        ASSIGN                                                   !1, 0
          9      > JMP                                                      ->16
    8    10    >   INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%28%5B0-9%5D%2B%29USD%28.%2B%29%2F'
         12        SEND_VAL                                                 'DATA-THAT-SHOULD-BE-REMOVED-%40%23%23%28%24%28%40%23+89USD'
         13        SEND_REF                                                 !2
         14        DO_ICALL                                                 
    7    15        PRE_INC                                                  !1
         16    >   FETCH_CONSTANT                                   ~9      'BENCHMARK_ITERATIONS'
         17        IS_SMALLER                                               !1, ~9
         18      > JMPNZ                                                    ~10, ->10
   11    19    >   INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $11     
         23        SUB                                              ~12     $11, !0
         24        SEND_VAL                                                 ~12
         25        DO_ICALL                                                 
   12    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 1
         28        DO_ICALL                                         $14     
         29        ASSIGN                                                   !0, $14
   14    30        ASSIGN                                                   !1, 0
         31      > JMP                                                      ->37
   15    32    >   INIT_FCALL                                               'substr'
         33        SEND_VAL                                                 'DATA-THAT-SHOULD-BE-REMOVED-%40%23%23%28%24%28%40%23+89USD'
         34        SEND_VAL                                                 36
         35        DO_ICALL                                                 
   14    36        PRE_INC                                                  !1
         37    >   FETCH_CONSTANT                                   ~19     'BENCHMARK_ITERATIONS'
         38        IS_SMALLER                                               !1, ~19
         39      > JMPNZ                                                    ~20, ->32
   18    40    >   INIT_FCALL                                               'var_dump'
         41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 1
         43        DO_ICALL                                         $21     
         44        SUB                                              ~22     $21, !0
         45        SEND_VAL                                                 ~22
         46        DO_ICALL                                                 
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.07 ms | 1392 KiB | 23 Q