3v4l.org

run code in 300+ PHP versions simultaneously
<?php function underscoreToCamelCase( $string, $first_char_caps = false) { if( $first_char_caps == true ) { $string[0] = strtoupper($string[0]); } $func = create_function('$c', 'return strtoupper($c[1]);'); return preg_replace_callback('/_([a-z])/', $func, $string); } echo underscoreToCamelCase('valami_underscored_cucc');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DmMOK
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'underscoretocamelcase'
          1        SEND_VAL                                                 'valami_underscored_cucc'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function underscoretocamelcase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/DmMOK
function name:  underscoreToCamelCase
number of ops:  22
compiled vars:  !0 = $string, !1 = $first_char_caps, !2 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    4     2        BOOL                                             ~3      !1
          3      > JMPZ                                                     ~3, ->10
    6     4    >   INIT_FCALL                                               'strtoupper'
          5        FETCH_DIM_R                                      ~5      !0, 0
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
          8        ASSIGN_DIM                                               !0, 0
          9        OP_DATA                                                  $6
    8    10    >   INIT_FCALL_BY_NAME                                       'create_function'
         11        SEND_VAL_EX                                              '%24c'
         12        SEND_VAL_EX                                              'return+strtoupper%28%24c%5B1%5D%29%3B'
         13        DO_FCALL                                      0  $7      
         14        ASSIGN                                                   !2, $7
    9    15        INIT_FCALL                                               'preg_replace_callback'
         16        SEND_VAL                                                 '%2F_%28%5Ba-z%5D%29%2F'
         17        SEND_VAR                                                 !2
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $9      
         20      > RETURN                                                   $9
   10    21*     > RETURN                                                   null

End of function underscoretocamelcase

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.13 ms | 1399 KiB | 18 Q