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(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"; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace_callback('/a/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/a/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtolower($a[0]); }, $str); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 30
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 30
Branch analysis from position: 76
Branch analysis from position: 30
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/I0cCV
function name:  (null)
number of ops:  84
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
    8     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    9     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->15
   10     7    >   ASSIGN                                                   !3, 'abc'
   11     8        INIT_FCALL                                               'preg_replace'
   12     9        SEND_VAL                                                 <array>
   20    10        SEND_VAL                                                 <array>
   27    11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $9      
   11    13        ASSIGN                                                   !3, $9
    9    14        PRE_INC                                                  !2
         15    >   IS_SMALLER                                               !2, !0
         16      > JMPNZ                                                    ~12, ->7
   30    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $13     
         20        SUB                                              ~14     $13, !1
         21        CONCAT                                           ~15     'Completed+in+', ~14
         22        CONCAT                                           ~16     ~15, '+Seconds%0A'
         23        ECHO                                                     ~16
   33    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !1, $17
   34    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->74
   35    30    >   ASSIGN                                                   !3, 'abc'
   36    31        INIT_FCALL                                               'preg_replace_callback'
         32        SEND_VAL                                                 '%2Fa%2F'
         33        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A36%240'
         34        SEND_VAL                                                 ~21
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $22     
         37        ASSIGN                                                   !3, $22
   37    38        INIT_FCALL                                               'preg_replace_callback'
         39        SEND_VAL                                                 '%2Fb%2F'
         40        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A37%241'
         41        SEND_VAL                                                 ~24
         42        SEND_VAR                                                 !3
         43        DO_ICALL                                         $25     
         44        ASSIGN                                                   !3, $25
   38    45        INIT_FCALL                                               'preg_replace_callback'
         46        SEND_VAL                                                 '%2Fc%2F'
         47        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A38%242'
         48        SEND_VAL                                                 ~27
         49        SEND_VAR                                                 !3
         50        DO_ICALL                                         $28     
         51        ASSIGN                                                   !3, $28
   39    52        INIT_FCALL                                               'preg_replace_callback'
         53        SEND_VAL                                                 '%2Fa%2F'
         54        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A39%243'
         55        SEND_VAL                                                 ~30
         56        SEND_VAR                                                 !3
         57        DO_ICALL                                         $31     
         58        ASSIGN                                                   !3, $31
   40    59        INIT_FCALL                                               'preg_replace_callback'
         60        SEND_VAL                                                 '%2Fb%2F'
         61        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A40%244'
         62        SEND_VAL                                                 ~33
         63        SEND_VAR                                                 !3
         64        DO_ICALL                                         $34     
         65        ASSIGN                                                   !3, $34
   41    66        INIT_FCALL                                               'preg_replace_callback'
         67        SEND_VAL                                                 '%2Fc%2F'
         68        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FI0cCV%3A41%245'
         69        SEND_VAL                                                 ~36
         70        SEND_VAR                                                 !3
         71        DO_ICALL                                         $37     
         72        ASSIGN                                                   !3, $37
   34    73        PRE_INC                                                  !2
         74    >   IS_SMALLER                                               !2, !0
         75      > JMPNZ                                                    ~40, ->30
   43    76    >   INIT_FCALL                                               'microtime'
         77        SEND_VAL                                                 <true>
         78        DO_ICALL                                         $41     
         79        SUB                                              ~42     $41, !1
         80        CONCAT                                           ~43     'Completed+in+', ~42
         81        CONCAT                                           ~44     ~43, '+Seconds%0A'
         82        ECHO                                                     ~44
         83      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A36%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtoupper'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A36%240

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A37%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtoupper'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A37%241

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A38%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtoupper'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A38%242

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A39%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtolower'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A39%243

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A40%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtolower'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A40%244

Function %00%7Bclosure%7D%2Fin%2FI0cCV%3A41%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I0cCV
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtolower'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FI0cCV%3A41%245

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.24 ms | 1408 KiB | 23 Q