3v4l.org

run code in 300+ PHP versions simultaneously
<?php function removeRepeatedCharacters($key){ $removeNext = false; for($i = 0; $i < strlen($key); $i++){ if($key[$i] == $key[$i+1]){ $key[$i] = ' '; $removeNext = true; } else if($removeNext){ $key[$i] =' '; $removeNext= false; } } echo str_replace(' ','',$key); } removeRepeatedCharacters('aabcccdee');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GLnJ2
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'removerepeatedcharacters'
          1        SEND_VAL                                                 'aabcccdee'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function removerepeatedcharacters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 4
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 4
Branch analysis from position: 21
Branch analysis from position: 4
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 4
Branch analysis from position: 21
Branch analysis from position: 4
Branch analysis from position: 17
filename:       /in/GLnJ2
function name:  removeRepeatedCharacters
number of ops:  28
compiled vars:  !0 = $key, !1 = $removeNext, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, <false>
    4     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->18
    6     4    >   FETCH_DIM_R                                      ~5      !0, !2
          5        ADD                                              ~6      !2, 1
          6        FETCH_DIM_R                                      ~7      !0, ~6
          7        IS_EQUAL                                                 ~5, ~7
          8      > JMPZ                                                     ~8, ->13
    7     9    >   ASSIGN_DIM                                               !0, !2
         10        OP_DATA                                                  '+'
    8    11        ASSIGN                                                   !1, <true>
         12      > JMP                                                      ->17
    9    13    > > JMPZ                                                     !1, ->17
   10    14    >   ASSIGN_DIM                                               !0, !2
         15        OP_DATA                                                  '+'
   11    16        ASSIGN                                                   !1, <false>
    4    17    >   PRE_INC                                                  !2
         18    >   STRLEN                                           ~14     !0
         19        IS_SMALLER                                               !2, ~14
         20      > JMPNZ                                                    ~15, ->4
   15    21    >   INIT_FCALL                                               'str_replace'
         22        SEND_VAL                                                 '+'
         23        SEND_VAL                                                 ''
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $16     
         26        ECHO                                                     $16
   16    27      > RETURN                                                   null

End of function removerepeatedcharacters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
316.99 ms | 1402 KiB | 17 Q