3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i=0; $time = microtime(true); while($i < 500) { $i++; @preg_replace('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1_\\2" : "\\2")', 'VeryLongClassName'); } $time = microtime(true) - $time; echo '1: ' . number_format($time, 3) ."\n"; $i=0; $time = microtime(true); while($i < 500) { $i++; @preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', '_'.'$0', 'VeryLongClassName')); } $time = microtime(true) - $time; echo '2: ' . number_format($time, 3) ."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 34
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 34
Branch analysis from position: 49
Branch analysis from position: 34
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
Branch analysis from position: 6
filename:       /in/4r4Bu
function name:  (null)
number of ops:  62
compiled vars:  !0 = $i, !1 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    4     5      > JMP                                                      ->14
    6     6    >   PRE_INC                                                  !0
    7     7        BEGIN_SILENCE                                    ~6      
          8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%28%5E%7C%5Ba-z%5D%29%28%5BA-Z%5D%29%2Fe'
         10        SEND_VAL                                                 'strtolower%28strlen%28%22%5C1%22%29+%3F+%22%5C1_%5C2%22+%3A+%22%5C2%22%29'
         11        SEND_VAL                                                 'VeryLongClassName'
         12        DO_ICALL                                                 
         13        END_SILENCE                                              ~6
    4    14    >   IS_SMALLER                                               !0, 500
         15      > JMPNZ                                                    ~8, ->6
   10    16    >   INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $9      
         19        SUB                                              ~10     $9, !1
         20        ASSIGN                                                   !1, ~10
   11    21        INIT_FCALL                                               'number_format'
         22        SEND_VAR                                                 !1
         23        SEND_VAL                                                 3
         24        DO_ICALL                                         $12     
         25        CONCAT                                           ~13     '1%3A+', $12
         26        CONCAT                                           ~14     ~13, '%0A'
         27        ECHO                                                     ~14
   13    28        ASSIGN                                                   !0, 0
   14    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $16     
         32        ASSIGN                                                   !1, $16
   15    33      > JMP                                                      ->47
   17    34    >   PRE_INC                                                  !0
   18    35        BEGIN_SILENCE                                    ~19     
         36        INIT_FCALL                                               'preg_replace'
         37        SEND_VAL                                                 '%2F%28%3F%21%5E%29%5B%5B%3Aupper%3A%5D%5D%5B%5B%3Alower%3A%5D%5D%2F'
         38        SEND_VAL                                                 '%240'
         39        INIT_FCALL                                               'preg_replace'
         40        SEND_VAL                                                 '%2F%28%3F%21%5E%29%5B%5B%3Aupper%3A%5D%5D%2B%2F'
         41        SEND_VAL                                                 '_%240'
         42        SEND_VAL                                                 'VeryLongClassName'
         43        DO_ICALL                                         $20     
         44        SEND_VAR                                                 $20
         45        DO_ICALL                                                 
         46        END_SILENCE                                              ~19
   15    47    >   IS_SMALLER                                               !0, 500
         48      > JMPNZ                                                    ~22, ->34
   21    49    >   INIT_FCALL                                               'microtime'
         50        SEND_VAL                                                 <true>
         51        DO_ICALL                                         $23     
         52        SUB                                              ~24     $23, !1
         53        ASSIGN                                                   !1, ~24
   22    54        INIT_FCALL                                               'number_format'
         55        SEND_VAR                                                 !1
         56        SEND_VAL                                                 3
         57        DO_ICALL                                         $26     
         58        CONCAT                                           ~27     '2%3A+', $26
         59        CONCAT                                           ~28     ~27, '%0A'
         60        ECHO                                                     ~28
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.97 ms | 1400 KiB | 19 Q