3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sequence = "aabbcc"; $occurrences = array(); $sequences = str_split($sequence); // dn($sequences); $sequences_amount = array(); foreach ($sequences as $key => $char) { if(!isset($sequences_amount[$char])){ $sequences_amount[$char] = 1; }else{ $sequences_amount[$char]++; } } var_dump($sequences_amount); function sequenceCount($data = array()) { if(!isset($data) || empty($data) || (count($data) == 0))return; $count = NULL; foreach ($data as $char => $amount) { if($count == NULL){ $count = $amount; }else{ $count = $count * $amount; } } return $count; } $count = sequenceCount($sequences_amount); echo("\n\nResult:\n"); echo($count);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/nUbHe
function name:  (null)
number of ops:  30
compiled vars:  !0 = $sequence, !1 = $occurrences, !2 = $sequences, !3 = $sequences_amount, !4 = $char, !5 = $key, !6 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aabbcc'
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !2, $9
    8     6        ASSIGN                                                   !3, <array>
   10     7      > FE_RESET_R                                       $12     !2, ->19
          8    > > FE_FETCH_R                                       ~13     $12, !4, ->19
          9    >   ASSIGN                                                   !5, ~13
   11    10        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !3, !4
         11        BOOL_NOT                                         ~16     ~15
         12      > JMPZ                                                     ~16, ->16
   12    13    >   ASSIGN_DIM                                               !3, !4
         14        OP_DATA                                                  1
   11    15      > JMP                                                      ->18
   14    16    >   FETCH_DIM_RW                                     $18     !3, !4
         17        PRE_INC                                                  $18
   10    18    > > JMP                                                      ->8
         19    >   FE_FREE                                                  $12
   19    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   38    23        INIT_FCALL                                               'sequencecount'
         24        SEND_VAR                                                 !3
         25        DO_FCALL                                      0  $21     
         26        ASSIGN                                                   !6, $21
   39    27        ECHO                                                     '%0A%0AResult%3A%0A'
   41    28        ECHO                                                     !6
         29      > RETURN                                                   1

Function sequencecount:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 10
Branch analysis from position: 6
filename:       /in/nUbHe
function name:  sequenceCount
number of ops:  26
compiled vars:  !0 = $data, !1 = $count, !2 = $amount, !3 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV_INIT                                        !0      <array>
   23     1        ISSET_ISEMPTY_CV                                 ~4      !0
          2        BOOL_NOT                                         ~5      ~4
          3      > JMPNZ_EX                                         ~5      ~5, ->6
          4    >   ISSET_ISEMPTY_CV                                 ~6      !0
          5        BOOL                                             ~5      ~6
          6    > > JMPNZ_EX                                         ~5      ~5, ->10
          7    >   COUNT                                            ~7      !0
          8        IS_EQUAL                                         ~8      ~7, 0
          9        BOOL                                             ~5      ~8
         10    > > JMPZ                                                     ~5, ->12
         11    > > RETURN                                                   null
   25    12    >   ASSIGN                                                   !1, null
   27    13      > FE_RESET_R                                       $10     !0, ->23
         14    > > FE_FETCH_R                                       ~11     $10, !2, ->23
         15    >   ASSIGN                                                   !3, ~11
   28    16        IS_EQUAL                                                 !1, null
         17      > JMPZ                                                     ~13, ->20
   29    18    >   ASSIGN                                                   !1, !2
   28    19      > JMP                                                      ->22
   31    20    >   MUL                                              ~15     !1, !2
         21        ASSIGN                                                   !1, ~15
   27    22    > > JMP                                                      ->14
         23    >   FE_FREE                                                  $10
   35    24      > RETURN                                                   !1
   36    25*     > RETURN                                                   null

End of function sequencecount

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.8 ms | 1006 KiB | 16 Q