3v4l.org

run code in 300+ PHP versions simultaneously
<?php function snakeToCamel($text, $firstUpper = true) { $regex = '/('; if ($firstUpper) { $regex .= '^|'; } $regex .= '_)([a-z])/e'; return preg_replace($regex, "strtoupper('\\2')", $text); } echo snakeToCamel('testFooBar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tRnnF
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'snaketocamel'
          1        SEND_VAL                                                 'testFooBar'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function snaketocamel:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/tRnnF
function name:  snakeToCamel
number of ops:  13
compiled vars:  !0 = $text, !1 = $firstUpper, !2 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
    5     2        ASSIGN                                                   !2, '%2F%28'
    6     3      > JMPZ                                                     !1, ->5
    7     4    >   ASSIGN_OP                                     8          !2, '%5E%7C'
    9     5    >   ASSIGN_OP                                     8          !2, '_%29%28%5Ba-z%5D%29%2Fe'
   11     6        INIT_FCALL                                               'preg_replace'
          7        SEND_VAR                                                 !2
          8        SEND_VAL                                                 'strtoupper%28%27%5C2%27%29'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11      > RETURN                                                   $6
   12    12*     > RETURN                                                   null

End of function snaketocamel

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.06 ms | 1397 KiB | 16 Q