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/', 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"; $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";

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 7
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 66
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 66
Branch analysis from position: 76
Branch analysis from position: 66
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 7
Branch analysis from position: 53
Branch analysis from position: 7
filename:       /in/Xn1UY
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
    6     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    7     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->51
    8     7    >   ASSIGN                                                   !3, 'abc'
    9     8        INIT_FCALL                                               'preg_replace_callback'
          9        SEND_VAL                                                 '%2Fa%2F'
         10        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         11        SEND_VAL                                                 ~9
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   10    15        INIT_FCALL                                               'preg_replace_callback'
         16        SEND_VAL                                                 '%2Fb%2F'
         17        DECLARE_LAMBDA_FUNCTION                          ~12     [1]
         18        SEND_VAL                                                 ~12
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !3, $13
   11    22        INIT_FCALL                                               'preg_replace_callback'
         23        SEND_VAL                                                 '%2Fc%2F'
         24        DECLARE_LAMBDA_FUNCTION                          ~15     [2]
         25        SEND_VAL                                                 ~15
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $16     
         28        ASSIGN                                                   !3, $16
   12    29        INIT_FCALL                                               'preg_replace_callback'
         30        SEND_VAL                                                 '%2Fa%2F'
         31        DECLARE_LAMBDA_FUNCTION                          ~18     [3]
         32        SEND_VAL                                                 ~18
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                         $19     
         35        ASSIGN                                                   !3, $19
   13    36        INIT_FCALL                                               'preg_replace_callback'
         37        SEND_VAL                                                 '%2Fb%2F'
         38        DECLARE_LAMBDA_FUNCTION                          ~21     [4]
         39        SEND_VAL                                                 ~21
         40        SEND_VAR                                                 !3
         41        DO_ICALL                                         $22     
         42        ASSIGN                                                   !3, $22
   14    43        INIT_FCALL                                               'preg_replace_callback'
         44        SEND_VAL                                                 '%2Fc%2F'
         45        DECLARE_LAMBDA_FUNCTION                          ~24     [5]
         46        SEND_VAL                                                 ~24
         47        SEND_VAR                                                 !3
         48        DO_ICALL                                         $25     
         49        ASSIGN                                                   !3, $25
    7    50        PRE_INC                                                  !2
         51    >   IS_SMALLER                                               !2, !0
         52      > JMPNZ                                                    ~28, ->7
   16    53    >   INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $29     
         56        SUB                                              ~30     $29, !1
         57        CONCAT                                           ~31     'Completed+in+', ~30
         58        CONCAT                                           ~32     ~31, '+Seconds%0A'
         59        ECHO                                                     ~32
   18    60        INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $33     
         63        ASSIGN                                                   !1, $33
   19    64        ASSIGN                                                   !2, 0
         65      > JMP                                                      ->74
   20    66    >   ASSIGN                                                   !3, 'abc'
   21    67        INIT_FCALL                                               'preg_replace'
   22    68        SEND_VAL                                                 <array>
   30    69        SEND_VAL                                                 <array>
   37    70        SEND_VAR                                                 !3
   21    71        DO_ICALL                                         $37     
         72        ASSIGN                                                   !3, $37
   19    73        PRE_INC                                                  !2
         74    >   IS_SMALLER                                               !2, !0
         75      > JMPNZ                                                    ~40, ->66
   40    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


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     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 Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     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 Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     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 Dynamic Function 2

Dynamic Function 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     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 Dynamic Function 3

Dynamic Function 4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     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 Dynamic Function 4

Dynamic Function 5
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xn1UY
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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 Dynamic Function 5

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.51 ms | 1015 KiB | 18 Q