3v4l.org

run code in 300+ PHP versions simultaneously
<?php function removeLowerCharBeforeUpperChar(string $input): string { $output = ''; $length = strlen($input); for ($offset = 0; $offset < $length; ++$offset) { $currentOrd = ord($input[$offset]); $nextOrd = ord($input[$offset + 1] ?? '_'); if ($currentOrd < 97 || $currentOrd > 122 || $nextOrd < 65 || $nextOrd > 90 ){ $output .= $input[$offset]; } } return $output; } echo removeLowerCharBeforeUpperChar('MickMacKusa');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cg7gG
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'removelowercharbeforeupperchar'
          1        SEND_VAL                                                 'MickMacKusa'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function removelowercharbeforeupperchar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 6
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 6
Branch analysis from position: 35
Branch analysis from position: 6
Branch analysis from position: 32
Branch analysis from position: 29
Branch analysis from position: 26
Branch analysis from position: 23
filename:       /in/Cg7gG
function name:  removeLowerCharBeforeUpperChar
number of ops:  39
compiled vars:  !0 = $input, !1 = $output, !2 = $length, !3 = $offset, !4 = $currentOrd, !5 = $nextOrd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        STRLEN                                           ~7      !0
          3        ASSIGN                                                   !2, ~7
    7     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->33
    8     6    >   INIT_FCALL                                               'ord'
          7        FETCH_DIM_R                                      ~10     !0, !3
          8        SEND_VAL                                                 ~10
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !4, $11
    9    11        INIT_FCALL                                               'ord'
         12        ADD                                              ~13     !3, 1
         13        FETCH_DIM_IS                                     ~14     !0, ~13
         14        COALESCE                                         ~15     ~14
         15        QM_ASSIGN                                        ~15     '_'
         16        SEND_VAL                                                 ~15
         17        DO_ICALL                                         $16     
         18        ASSIGN                                                   !5, $16
   11    19        IS_SMALLER                                       ~18     !4, 97
         20      > JMPNZ_EX                                         ~18     ~18, ->23
   12    21    >   IS_SMALLER                                       ~19     122, !4
         22        BOOL                                             ~18     ~19
         23    > > JMPNZ_EX                                         ~18     ~18, ->26
   13    24    >   IS_SMALLER                                       ~20     !5, 65
         25        BOOL                                             ~18     ~20
         26    > > JMPNZ_EX                                         ~18     ~18, ->29
   14    27    >   IS_SMALLER                                       ~21     90, !5
         28        BOOL                                             ~18     ~21
         29    > > JMPZ                                                     ~18, ->32
   16    30    >   FETCH_DIM_R                                      ~22     !0, !3
         31        ASSIGN_OP                                     8          !1, ~22
    7    32    >   PRE_INC                                                  !3
         33    >   IS_SMALLER                                               !3, !2
         34      > JMPNZ                                                    ~25, ->6
   19    35    >   VERIFY_RETURN_TYPE                                       !1
         36      > RETURN                                                   !1
   20    37*       VERIFY_RETURN_TYPE                                       
         38*     > RETURN                                                   null

End of function removelowercharbeforeupperchar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.06 ms | 1017 KiB | 15 Q