3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'SiteContentManagement'; echo strtolower(preg_replace('~(?!^)(?=[A-Z])~', '-', $string)); echo "\n"; echo strtolower(preg_replace('~(?!^)[A-Z]~', '-$0', $string)); echo "\n"; echo strtolower(preg_replace('~[^A-Z]+\K(?=[A-Z])~', '-', $string));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fijOP
function name:  (null)
number of ops:  31
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'SiteContentManagement'
    3     1        INIT_FCALL                                               'strtolower'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%7E%28%3F%21%5E%29%28%3F%3D%5BA-Z%5D%29%7E'
          4        SEND_VAL                                                 '-'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
    4    10        ECHO                                                     '%0A'
    5    11        INIT_FCALL                                               'strtolower'
         12        INIT_FCALL                                               'preg_replace'
         13        SEND_VAL                                                 '%7E%28%3F%21%5E%29%5BA-Z%5D%7E'
         14        SEND_VAL                                                 '-%240'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                         $5      
         19        ECHO                                                     $5
    6    20        ECHO                                                     '%0A'
    7    21        INIT_FCALL                                               'strtolower'
         22        INIT_FCALL                                               'preg_replace'
         23        SEND_VAL                                                 '%7E%5B%5EA-Z%5D%2B%5CK%28%3F%3D%5BA-Z%5D%29%7E'
         24        SEND_VAL                                                 '-'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $6      
         27        SEND_VAR                                                 $6
         28        DO_ICALL                                         $7      
         29        ECHO                                                     $7
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.5 ms | 1003 KiB | 15 Q