3v4l.org

run code in 500+ PHP versions simultaneously
<?php function camelCaseToUnderscore($input) { return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input)); } echo camelCaseToUnderscore('CamelCaseForTheWin'), "\n"; echo camelCaseToUnderscore('ACar'), "\n"; echo camelCaseToUnderscore('BuyACar'), "\n"; echo camelCaseToUnderscore('XML'), "\n"; echo camelCaseToUnderscore('SimpleXML'), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J1eMO
function name:  (null)
number of ops:  26
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                                   'camelcasetounderscore'
          1        SEND_VAL                                                     'CamelCaseForTheWin'
          2        DO_FCALL                                          0  $0      
          3        ECHO                                                         $0
          4        ECHO                                                         '%0A'
    9     5        INIT_FCALL                                                   'camelcasetounderscore'
          6        SEND_VAL                                                     'ACar'
          7        DO_FCALL                                          0  $1      
          8        ECHO                                                         $1
          9        ECHO                                                         '%0A'
   10    10        INIT_FCALL                                                   'camelcasetounderscore'
         11        SEND_VAL                                                     'BuyACar'
         12        DO_FCALL                                          0  $2      
         13        ECHO                                                         $2
         14        ECHO                                                         '%0A'
   11    15        INIT_FCALL                                                   'camelcasetounderscore'
         16        SEND_VAL                                                     'XML'
         17        DO_FCALL                                          0  $3      
         18        ECHO                                                         $3
         19        ECHO                                                         '%0A'
   12    20        INIT_FCALL                                                   'camelcasetounderscore'
         21        SEND_VAL                                                     'SimpleXML'
         22        DO_FCALL                                          0  $4      
         23        ECHO                                                         $4
         24        ECHO                                                         '%0A'
         25      > RETURN                                                       1

Function camelcasetounderscore:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J1eMO
function name:  camelCaseToUnderscore
number of ops:  8
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        INIT_FCALL                                                   'strtolower'
          2        FRAMELESS_ICALL_3                preg_replace        ~1      '%2F%28%3F%3C%21%5E%29%5BA-Z%5D%2F', '_%240'
          3        OP_DATA                                                      !0
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                             $2      
          6      > RETURN                                                       $2
    6     7*     > RETURN                                                       null

End of function camelcasetounderscore

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.94 ms | 2611 KiB | 19 Q