3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dashesToCamelCase($string, $capitalizeFirstCharacter = false) { $str = str_replace(' ', '', ucwords(str_replace('-', ' ', $string))); if (!$capitalizeFirstCharacter) { $str[0] = strtolower($str[0]); } return $str; } echo dashesToCamelCase('this-is-a-string');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rSlGF
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'dashestocamelcase'
          1        SEND_VAL                                                 'this-is-a-string'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function dashestocamelcase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/rSlGF
function name:  dashesToCamelCase
number of ops:  26
compiled vars:  !0 = $string, !1 = $capitalizeFirstCharacter, !2 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    6     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 '+'
          4        SEND_VAL                                                 ''
          5        INIT_FCALL                                               'ucwords'
          6        INIT_FCALL                                               'str_replace'
          7        SEND_VAL                                                 '-'
          8        SEND_VAL                                                 '+'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                         $5      
         15        ASSIGN                                                   !2, $5
    8    16        BOOL_NOT                                         ~7      !1
         17      > JMPZ                                                     ~7, ->24
    9    18    >   INIT_FCALL                                               'strtolower'
         19        FETCH_DIM_R                                      ~9      !2, 0
         20        SEND_VAL                                                 ~9
         21        DO_ICALL                                         $10     
         22        ASSIGN_DIM                                               !2, 0
         23        OP_DATA                                                  $10
   12    24    > > RETURN                                                   !2
   13    25*     > RETURN                                                   null

End of function dashestocamelcase

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.45 ms | 1399 KiB | 20 Q