3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i=0; $time = microtime(true); while($i < 50) { $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 < 50) { $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 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 32
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 32
Branch analysis from position: 45
Branch analysis from position: 32
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
Branch analysis from position: 6
filename:       /in/frnt8
function name:  (null)
number of ops:  58
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                                                      ->12
    6     6    >   PRE_INC                                                  !0
    7     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%2F%28%5E%7C%5Ba-z%5D%29%28%5BA-Z%5D%29%2Fe'
          9        SEND_VAL                                                 'strtolower%28strlen%28%22%5C1%22%29+%3F+%22%5C1_%5C2%22+%3A+%22%5C2%22%29'
         10        SEND_VAL                                                 'VeryLongClassName'
         11        DO_ICALL                                                 
    4    12    >   IS_SMALLER                                               !0, 50
         13      > JMPNZ                                                    ~7, ->6
   10    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $8      
         17        SUB                                              ~9      $8, !1
         18        ASSIGN                                                   !1, ~9
   11    19        INIT_FCALL                                               'number_format'
         20        SEND_VAR                                                 !1
         21        SEND_VAL                                                 3
         22        DO_ICALL                                         $11     
         23        CONCAT                                           ~12     '1%3A+', $11
         24        CONCAT                                           ~13     ~12, '%0A'
         25        ECHO                                                     ~13
   13    26        ASSIGN                                                   !0, 0
   14    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $15     
         30        ASSIGN                                                   !1, $15
   15    31      > JMP                                                      ->43
   17    32    >   PRE_INC                                                  !0
   18    33        INIT_FCALL                                               'preg_replace'
         34        SEND_VAL                                                 '%2F%28%3F%21%5E%29%5B%5B%3Aupper%3A%5D%5D%5B%5B%3Alower%3A%5D%5D%2F'
         35        SEND_VAL                                                 '%240'
         36        INIT_FCALL                                               'preg_replace'
         37        SEND_VAL                                                 '%2F%28%3F%21%5E%29%5B%5B%3Aupper%3A%5D%5D%2B%2F'
         38        SEND_VAL                                                 '_%240'
         39        SEND_VAL                                                 'VeryLongClassName'
         40        DO_ICALL                                         $18     
         41        SEND_VAR                                                 $18
         42        DO_ICALL                                                 
   15    43    >   IS_SMALLER                                               !0, 50
         44      > JMPNZ                                                    ~20, ->32
   21    45    >   INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $21     
         48        SUB                                              ~22     $21, !1
         49        ASSIGN                                                   !1, ~22
   22    50        INIT_FCALL                                               'number_format'
         51        SEND_VAR                                                 !1
         52        SEND_VAL                                                 3
         53        DO_ICALL                                         $24     
         54        CONCAT                                           ~25     '2%3A+', $24
         55        CONCAT                                           ~26     ~25, '%0A'
         56        ECHO                                                     ~26
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.34 ms | 1400 KiB | 19 Q