3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 100; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace_callback('/a/', 'strtoupper', $str); $str = preg_replace_callback('/b/', 'strtoupper', $str); $str = preg_replace_callback('/c/', 'strtoupper', $str); $str = preg_replace_callback('/a/', 'strtolower', $str); $str = preg_replace_callback('/b/', 'strtolower', $str); $str = preg_replace_callback('/c/', 'strtolower', $str); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n"; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace(array( '/a/e', '/b/e', '/c/e', '/a/e', '/b/e', '/c/e', ), array( 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', ), $str ); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 7
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 60
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 60
Branch analysis from position: 70
Branch analysis from position: 60
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 7
Branch analysis from position: 47
Branch analysis from position: 7
filename:       /in/uTsbl
function name:  (null)
number of ops:  78
compiled vars:  !0 = $count, !1 = $start, !2 = $i, !3 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 100
    6     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    7     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->45
    8     7    >   ASSIGN                                                   !3, 'abc'
    9     8        INIT_FCALL                                               'preg_replace_callback'
          9        SEND_VAL                                                 '%2Fa%2F'
         10        SEND_VAL                                                 'strtoupper'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !3, $9
   10    14        INIT_FCALL                                               'preg_replace_callback'
         15        SEND_VAL                                                 '%2Fb%2F'
         16        SEND_VAL                                                 'strtoupper'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !3, $11
   11    20        INIT_FCALL                                               'preg_replace_callback'
         21        SEND_VAL                                                 '%2Fc%2F'
         22        SEND_VAL                                                 'strtoupper'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $13     
         25        ASSIGN                                                   !3, $13
   12    26        INIT_FCALL                                               'preg_replace_callback'
         27        SEND_VAL                                                 '%2Fa%2F'
         28        SEND_VAL                                                 'strtolower'
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $15     
         31        ASSIGN                                                   !3, $15
   13    32        INIT_FCALL                                               'preg_replace_callback'
         33        SEND_VAL                                                 '%2Fb%2F'
         34        SEND_VAL                                                 'strtolower'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $17     
         37        ASSIGN                                                   !3, $17
   14    38        INIT_FCALL                                               'preg_replace_callback'
         39        SEND_VAL                                                 '%2Fc%2F'
         40        SEND_VAL                                                 'strtolower'
         41        SEND_VAR                                                 !3
         42        DO_ICALL                                         $19     
         43        ASSIGN                                                   !3, $19
    7    44        PRE_INC                                                  !2
         45    >   IS_SMALLER                                               !2, !0
         46      > JMPNZ                                                    ~22, ->7
   16    47    >   INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $23     
         50        SUB                                              ~24     $23, !1
         51        CONCAT                                           ~25     'Completed+in+', ~24
         52        CONCAT                                           ~26     ~25, '+Seconds%0A'
         53        ECHO                                                     ~26
   18    54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $27     
         57        ASSIGN                                                   !1, $27
   19    58        ASSIGN                                                   !2, 0
         59      > JMP                                                      ->68
   20    60    >   ASSIGN                                                   !3, 'abc'
   21    61        INIT_FCALL                                               'preg_replace'
   22    62        SEND_VAL                                                 <array>
   30    63        SEND_VAL                                                 <array>
   37    64        SEND_VAR                                                 !3
         65        DO_ICALL                                         $31     
   21    66        ASSIGN                                                   !3, $31
   19    67        PRE_INC                                                  !2
         68    >   IS_SMALLER                                               !2, !0
         69      > JMPNZ                                                    ~34, ->60
   40    70    >   INIT_FCALL                                               'microtime'
         71        SEND_VAL                                                 <true>
         72        DO_ICALL                                         $35     
         73        SUB                                              ~36     $35, !1
         74        CONCAT                                           ~37     'Completed+in+', ~36
         75        CONCAT                                           ~38     ~37, '+Seconds%0A'
         76        ECHO                                                     ~38
         77      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.65 ms | 1400 KiB | 19 Q