3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($propertyName): string { $lcPropertyName = lcfirst($propertyName); $snakeCasedName = ''; $len = strlen($lcPropertyName); for ($i = 0; $i < $len; ++$i) { if (ctype_upper($propertyName[$i])) { $snakeCasedName .= '_'.strtolower($propertyName[$i]); } else { $snakeCasedName .= strtolower($propertyName[$i]); } } return $snakeCasedName; } echo f('ThisIsATest').PHP_EOL; echo f('thisIsATest');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTioM
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'f'
          1        SEND_VAL                                                 'ThisIsATest'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   22     5        INIT_FCALL                                               'f'
          6        SEND_VAL                                                 'thisIsATest'
          7        DO_FCALL                                      0  $2      
          8        ECHO                                                     $2
          9      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 10
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 10
Branch analysis from position: 30
Branch analysis from position: 10
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 10
Branch analysis from position: 30
Branch analysis from position: 10
filename:       /in/qTioM
function name:  f
number of ops:  34
compiled vars:  !0 = $propertyName, !1 = $lcPropertyName, !2 = $snakeCasedName, !3 = $len, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'lcfirst'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    6     5        ASSIGN                                                   !2, ''
    8     6        STRLEN                                           ~8      !1
          7        ASSIGN                                                   !3, ~8
   10     8        ASSIGN                                                   !4, 0
          9      > JMP                                                      ->28
   11    10    >   INIT_FCALL                                               'ctype_upper'
         11        FETCH_DIM_R                                      ~11     !0, !4
         12        SEND_VAL                                                 ~11
         13        DO_ICALL                                         $12     
         14      > JMPZ                                                     $12, ->22
   12    15    >   INIT_FCALL                                               'strtolower'
         16        FETCH_DIM_R                                      ~13     !0, !4
         17        SEND_VAL                                                 ~13
         18        DO_ICALL                                         $14     
         19        CONCAT                                           ~15     '_', $14
         20        ASSIGN_OP                                     8          !2, ~15
         21      > JMP                                                      ->27
   14    22    >   INIT_FCALL                                               'strtolower'
         23        FETCH_DIM_R                                      ~17     !0, !4
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                         $18     
         26        ASSIGN_OP                                     8          !2, $18
   10    27    >   PRE_INC                                                  !4
         28    >   IS_SMALLER                                               !4, !3
         29      > JMPNZ                                                    ~21, ->10
   18    30    >   VERIFY_RETURN_TYPE                                       !2
         31      > RETURN                                                   !2
   19    32*       VERIFY_RETURN_TYPE                                       
         33*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.32 ms | 1403 KiB | 21 Q