3v4l.org

run code in 300+ PHP versions simultaneously
<?php function duplicate_encode($word){ $final = ""; foreach (str_split($word) as $char) { if (strpos($word,$char) !== strrpos($word,$char)) { $final .= ')'; } else { $final .= '('; } } return $final; } echo duplicate_encode("din");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QKLsS
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'duplicate_encode'
          1        SEND_VAL                                                 'din'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function duplicate_encode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/QKLsS
function name:  duplicate_encode
number of ops:  24
compiled vars:  !0 = $word, !1 = $final, !2 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5      > FE_RESET_R                                       $5      $4, ->21
          6    > > FE_FETCH_R                                               $5, !2, ->21
    7     7    >   INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $6      
         11        INIT_FCALL                                               'strrpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $7      
         15        IS_NOT_IDENTICAL                                         $6, $7
         16      > JMPZ                                                     ~8, ->19
    8    17    >   ASSIGN_OP                                     8          !1, '%29'
    7    18      > JMP                                                      ->20
   10    19    >   ASSIGN_OP                                     8          !1, '%28'
    6    20    > > JMP                                                      ->6
         21    >   FE_FREE                                                  $5
   14    22      > RETURN                                                   !1
   15    23*     > RETURN                                                   null

End of function duplicate_encode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
243 ms | 1016 KiB | 17 Q