3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cha12 = array(); $cha1_count = 3; $cha2_count = 3; $cha12[0][0] = 3; $cha12[0][1] = 6; $cha12[0][2] = 2; $cha12[1][0] = 4; $cha12[1][1] = 5; $cha12[1][2] = 3; $cha12[2][0] = 2; $cha12[2][1] = 2; $cha12[2][2] = 8; $fcount = 0; $fcount_array = array(); $fc = 0; for($count1=0;$count1<$cha1_count;$count1++){ for($count2=0;$count2<$cha2_count;$count2++){ $fc = ($cha2_count * $count1) + $count2; $fcount_array[$fc] = $cha12[$count1][$count2]; } } asort($fcount_array); print_r($fcount_array); //1 $akf = array_keys($fcount_array); print_r($akf); //2 $acv = array_count_values($fcount_array); print_r($acv); //3 $ak = array_keys($acv); print_r($ak); //4 $ak_count = count($ak); $ak_sum = 0; if($cha1_count <= $cha2_count){ $sum = $ak[$ak_count-1]*$cha1_count; //合計の最大値をとりあえず決めておく for($i=0;$i<$ak_count;$i++){ $ak_sum = $ak_sum + $acv[$ak[$i]]; if($ak_sum < $cha1_count){ break; } for($j=0;$j<$ak_sum-$cha1_count+1;$j++){ $c=1; $c1=array(); $c2=array(); $n_sum=$cha12[floor($akf[$j]/$cha1_count)][$akf[$j]%$cha1_count]; $c1[0]=floor($akf[$j]/$cha1_count); $c2[0]=$akf[$j]%$cha1_count; for($k=$j+1;$k<$ak_sum;$k++){ if($c<$cha1_count){ for($m=0;$m<$c;$m++){ if(floor($akf[$k]/$cha1_count) == $c1[$m] || $akf[$k]%$cha1_count == $c2[$m]){ break; } } $c1[$c]=floor($akf[$k]/$cha1_count); $c2[$c]=$akf[$k]%$cha1_count; $n_sum=$n_sum+$cha12[floor($akf[$k]/$cha1_count)][$akf[$k]%$cha1_count]; $c++; if($c==$cha1_count && $n_sum<$sum){ $sum=$n_sum; } } } } } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 35
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 186
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 184
Branch analysis from position: 184
2 jumps found. (Code = 44) Position 1 = 186, Position 2 = 88
Branch analysis from position: 186
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 95
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 186
Branch analysis from position: 186
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
2 jumps found. (Code = 44) Position 1 = 183, Position 2 = 97
Branch analysis from position: 183
2 jumps found. (Code = 44) Position 1 = 186, Position 2 = 88
Branch analysis from position: 186
Branch analysis from position: 88
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 176
Branch analysis from position: 176
2 jumps found. (Code = 44) Position 1 = 178, Position 2 = 124
Branch analysis from position: 178
2 jumps found. (Code = 44) Position 1 = 183, Position 2 = 97
Branch analysis from position: 183
Branch analysis from position: 97
Branch analysis from position: 124
2 jumps found. (Code = 43) Position 1 = 126, Position 2 = 175
Branch analysis from position: 126
1 jumps found. (Code = 42) Position 1 = 144
Branch analysis from position: 144
2 jumps found. (Code = 44) Position 1 = 146, Position 2 = 128
Branch analysis from position: 146
2 jumps found. (Code = 46) Position 1 = 171, Position 2 = 173
Branch analysis from position: 171
2 jumps found. (Code = 43) Position 1 = 174, Position 2 = 175
Branch analysis from position: 174
2 jumps found. (Code = 44) Position 1 = 178, Position 2 = 124
Branch analysis from position: 178
Branch analysis from position: 124
Branch analysis from position: 175
Branch analysis from position: 173
Branch analysis from position: 128
2 jumps found. (Code = 47) Position 1 = 136, Position 2 = 141
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 142, Position 2 = 143
Branch analysis from position: 142
1 jumps found. (Code = 42) Position 1 = 146
Branch analysis from position: 146
Branch analysis from position: 143
2 jumps found. (Code = 44) Position 1 = 146, Position 2 = 128
Branch analysis from position: 146
Branch analysis from position: 128
Branch analysis from position: 141
Branch analysis from position: 175
Branch analysis from position: 186
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 37
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 35
Branch analysis from position: 50
Branch analysis from position: 35
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 37
Branch analysis from position: 47
Branch analysis from position: 37
filename:       /in/TOK7t
function name:  (null)
number of ops:  187
compiled vars:  !0 = $cha12, !1 = $cha1_count, !2 = $cha2_count, !3 = $fcount, !4 = $fcount_array, !5 = $fc, !6 = $count1, !7 = $count2, !8 = $akf, !9 = $acv, !10 = $ak, !11 = $ak_count, !12 = $ak_sum, !13 = $sum, !14 = $i, !15 = $j, !16 = $c, !17 = $c1, !18 = $c2, !19 = $n_sum, !20 = $k, !21 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 3
    4     2        ASSIGN                                                   !2, 3
    5     3        FETCH_DIM_W                                      $25     !0, 0
          4        ASSIGN_DIM                                               $25, 0
          5        OP_DATA                                                  3
    6     6        FETCH_DIM_W                                      $27     !0, 0
          7        ASSIGN_DIM                                               $27, 1
          8        OP_DATA                                                  6
    7     9        FETCH_DIM_W                                      $29     !0, 0
         10        ASSIGN_DIM                                               $29, 2
         11        OP_DATA                                                  2
    8    12        FETCH_DIM_W                                      $31     !0, 1
         13        ASSIGN_DIM                                               $31, 0
         14        OP_DATA                                                  4
    9    15        FETCH_DIM_W                                      $33     !0, 1
         16        ASSIGN_DIM                                               $33, 1
         17        OP_DATA                                                  5
   10    18        FETCH_DIM_W                                      $35     !0, 1
         19        ASSIGN_DIM                                               $35, 2
         20        OP_DATA                                                  3
   11    21        FETCH_DIM_W                                      $37     !0, 2
         22        ASSIGN_DIM                                               $37, 0
         23        OP_DATA                                                  2
   12    24        FETCH_DIM_W                                      $39     !0, 2
         25        ASSIGN_DIM                                               $39, 1
         26        OP_DATA                                                  2
   13    27        FETCH_DIM_W                                      $41     !0, 2
         28        ASSIGN_DIM                                               $41, 2
         29        OP_DATA                                                  8
   14    30        ASSIGN                                                   !3, 0
   15    31        ASSIGN                                                   !4, <array>
   16    32        ASSIGN                                                   !5, 0
   17    33        ASSIGN                                                   !6, 0
         34      > JMP                                                      ->48
   18    35    >   ASSIGN                                                   !7, 0
         36      > JMP                                                      ->45
   19    37    >   MUL                                              ~48     !2, !6
         38        ADD                                              ~49     ~48, !7
         39        ASSIGN                                                   !5, ~49
   20    40        FETCH_DIM_R                                      ~52     !0, !6
         41        FETCH_DIM_R                                      ~53     ~52, !7
         42        ASSIGN_DIM                                               !4, !5
         43        OP_DATA                                                  ~53
   18    44        PRE_INC                                                  !7
         45    >   IS_SMALLER                                               !7, !2
         46      > JMPNZ                                                    ~55, ->37
   17    47    >   PRE_INC                                                  !6
         48    >   IS_SMALLER                                               !6, !1
         49      > JMPNZ                                                    ~57, ->35
   23    50    >   INIT_FCALL                                               'asort'
         51        SEND_REF                                                 !4
         52        DO_ICALL                                                 
   24    53        INIT_FCALL                                               'print_r'
         54        SEND_VAR                                                 !4
         55        DO_ICALL                                                 
   25    56        INIT_FCALL                                               'array_keys'
         57        SEND_VAR                                                 !4
         58        DO_ICALL                                         $60     
         59        ASSIGN                                                   !8, $60
   26    60        INIT_FCALL                                               'print_r'
         61        SEND_VAR                                                 !8
         62        DO_ICALL                                                 
   27    63        INIT_FCALL                                               'array_count_values'
         64        SEND_VAR                                                 !4
         65        DO_ICALL                                         $63     
         66        ASSIGN                                                   !9, $63
   28    67        INIT_FCALL                                               'print_r'
         68        SEND_VAR                                                 !9
         69        DO_ICALL                                                 
   29    70        INIT_FCALL                                               'array_keys'
         71        SEND_VAR                                                 !9
         72        DO_ICALL                                         $66     
         73        ASSIGN                                                   !10, $66
   30    74        INIT_FCALL                                               'print_r'
         75        SEND_VAR                                                 !10
         76        DO_ICALL                                                 
   31    77        COUNT                                            ~69     !10
         78        ASSIGN                                                   !11, ~69
   32    79        ASSIGN                                                   !12, 0
   33    80        IS_SMALLER_OR_EQUAL                                      !1, !2
         81      > JMPZ                                                     ~72, ->186
   34    82    >   SUB                                              ~73     !11, 1
         83        FETCH_DIM_R                                      ~74     !10, ~73
         84        MUL                                              ~75     !1, ~74
         85        ASSIGN                                                   !13, ~75
   35    86        ASSIGN                                                   !14, 0
         87      > JMP                                                      ->184
   36    88    >   FETCH_DIM_R                                      ~78     !10, !14
         89        FETCH_DIM_R                                      ~79     !9, ~78
         90        ADD                                              ~80     !12, ~79
         91        ASSIGN                                                   !12, ~80
   37    92        IS_SMALLER                                               !12, !1
         93      > JMPZ                                                     ~82, ->95
   38    94    > > JMP                                                      ->186
   40    95    >   ASSIGN                                                   !15, 0
         96      > JMP                                                      ->179
   41    97    >   ASSIGN                                                   !16, 1
   42    98        ASSIGN                                                   !17, <array>
   43    99        ASSIGN                                                   !18, <array>
   44   100        INIT_FCALL                                               'floor'
        101        FETCH_DIM_R                                      ~87     !8, !15
        102        DIV                                              ~88     ~87, !1
        103        SEND_VAL                                                 ~88
        104        DO_ICALL                                         $89     
        105        FETCH_DIM_R                                      ~91     !8, !15
        106        MOD                                              ~92     ~91, !1
        107        FETCH_DIM_R                                      ~90     !0, $89
        108        FETCH_DIM_R                                      ~93     ~90, ~92
        109        ASSIGN                                                   !19, ~93
   45   110        INIT_FCALL                                               'floor'
        111        FETCH_DIM_R                                      ~96     !8, !15
        112        DIV                                              ~97     ~96, !1
        113        SEND_VAL                                                 ~97
        114        DO_ICALL                                         $98     
        115        ASSIGN_DIM                                               !17, 0
        116        OP_DATA                                                  $98
   46   117        FETCH_DIM_R                                      ~100    !8, !15
        118        MOD                                              ~101    ~100, !1
        119        ASSIGN_DIM                                               !18, 0
        120        OP_DATA                                                  ~101
   47   121        ADD                                              ~102    !15, 1
        122        ASSIGN                                                   !20, ~102
        123      > JMP                                                      ->176
   48   124    >   IS_SMALLER                                               !16, !1
        125      > JMPZ                                                     ~104, ->175
   49   126    >   ASSIGN                                                   !21, 0
        127      > JMP                                                      ->144
   50   128    >   INIT_FCALL                                               'floor'
        129        FETCH_DIM_R                                      ~106    !8, !20
        130        DIV                                              ~107    ~106, !1
        131        SEND_VAL                                                 ~107
        132        DO_ICALL                                         $108    
        133        FETCH_DIM_R                                      ~109    !17, !21
        134        IS_EQUAL                                         ~110    $108, ~109
        135      > JMPNZ_EX                                         ~110    ~110, ->141
        136    >   FETCH_DIM_R                                      ~111    !8, !20
        137        MOD                                              ~112    ~111, !1
        138        FETCH_DIM_R                                      ~113    !18, !21
        139        IS_EQUAL                                         ~114    ~112, ~113
        140        BOOL                                             ~110    ~114
        141    > > JMPZ                                                     ~110, ->143
   51   142    > > JMP                                                      ->146
   49   143    >   PRE_INC                                                  !21
        144    >   IS_SMALLER                                               !21, !16
        145      > JMPNZ                                                    ~116, ->128
   54   146    >   INIT_FCALL                                               'floor'
        147        FETCH_DIM_R                                      ~118    !8, !20
        148        DIV                                              ~119    ~118, !1
        149        SEND_VAL                                                 ~119
        150        DO_ICALL                                         $120    
        151        ASSIGN_DIM                                               !17, !16
        152        OP_DATA                                                  $120
   55   153        FETCH_DIM_R                                      ~122    !8, !20
        154        MOD                                              ~123    ~122, !1
        155        ASSIGN_DIM                                               !18, !16
        156        OP_DATA                                                  ~123
   56   157        INIT_FCALL                                               'floor'
        158        FETCH_DIM_R                                      ~124    !8, !20
        159        DIV                                              ~125    ~124, !1
        160        SEND_VAL                                                 ~125
        161        DO_ICALL                                         $126    
        162        FETCH_DIM_R                                      ~128    !8, !20
        163        MOD                                              ~129    ~128, !1
        164        FETCH_DIM_R                                      ~127    !0, $126
        165        FETCH_DIM_R                                      ~130    ~127, ~129
        166        ADD                                              ~131    !19, ~130
        167        ASSIGN                                                   !19, ~131
   57   168        PRE_INC                                                  !16
   58   169        IS_EQUAL                                         ~134    !16, !1
        170      > JMPZ_EX                                          ~134    ~134, ->173
        171    >   IS_SMALLER                                       ~135    !19, !13
        172        BOOL                                             ~134    ~135
        173    > > JMPZ                                                     ~134, ->175
   59   174    >   ASSIGN                                                   !13, !19
   47   175    >   PRE_INC                                                  !20
        176    >   IS_SMALLER                                               !20, !12
        177      > JMPNZ                                                    ~138, ->124
   40   178    >   PRE_INC                                                  !15
        179    >   SUB                                              ~140    !12, !1
        180        ADD                                              ~141    ~140, 1
        181        IS_SMALLER                                               !15, ~141
        182      > JMPNZ                                                    ~142, ->97
   35   183    >   PRE_INC                                                  !14
        184    >   IS_SMALLER                                               !14, !11
        185      > JMPNZ                                                    ~144, ->88
   67   186    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.44 ms | 1417 KiB | 23 Q