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 = 189
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 187
Branch analysis from position: 187
2 jumps found. (Code = 44) Position 1 = 189, Position 2 = 88
Branch analysis from position: 189
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 96
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 189
Branch analysis from position: 189
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 182
Branch analysis from position: 182
2 jumps found. (Code = 44) Position 1 = 186, Position 2 = 98
Branch analysis from position: 186
2 jumps found. (Code = 44) Position 1 = 189, Position 2 = 88
Branch analysis from position: 189
Branch analysis from position: 88
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 127
Branch analysis from position: 181
2 jumps found. (Code = 44) Position 1 = 186, Position 2 = 98
Branch analysis from position: 186
Branch analysis from position: 98
Branch analysis from position: 127
2 jumps found. (Code = 43) Position 1 = 129, Position 2 = 178
Branch analysis from position: 129
1 jumps found. (Code = 42) Position 1 = 147
Branch analysis from position: 147
2 jumps found. (Code = 44) Position 1 = 149, Position 2 = 131
Branch analysis from position: 149
2 jumps found. (Code = 46) Position 1 = 174, Position 2 = 176
Branch analysis from position: 174
2 jumps found. (Code = 43) Position 1 = 177, Position 2 = 178
Branch analysis from position: 177
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 127
Branch analysis from position: 181
Branch analysis from position: 127
Branch analysis from position: 178
Branch analysis from position: 176
Branch analysis from position: 131
2 jumps found. (Code = 47) Position 1 = 139, Position 2 = 144
Branch analysis from position: 139
2 jumps found. (Code = 43) Position 1 = 145, Position 2 = 146
Branch analysis from position: 145
1 jumps found. (Code = 42) Position 1 = 149
Branch analysis from position: 149
Branch analysis from position: 146
2 jumps found. (Code = 44) Position 1 = 149, Position 2 = 131
Branch analysis from position: 149
Branch analysis from position: 131
Branch analysis from position: 144
Branch analysis from position: 178
Branch analysis from position: 189
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/hYS9h
function name:  (null)
number of ops:  190
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, ->189
   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                                                      ->187
   36    88    >   FETCH_CONSTANT                                   ~78     'i'
         89        FETCH_DIM_R                                      ~79     !10, ~78
         90        FETCH_DIM_R                                      ~80     !9, ~79
         91        ADD                                              ~81     !12, ~80
         92        ASSIGN                                                   !12, ~81
   37    93        IS_SMALLER                                               !12, !1
         94      > JMPZ                                                     ~83, ->96
   38    95    > > JMP                                                      ->189
   40    96    >   ASSIGN                                                   !15, 0
         97      > JMP                                                      ->182
   41    98    >   ASSIGN                                                   !16, 1
   42    99        ASSIGN                                                   !17, <array>
   43   100        ASSIGN                                                   !18, <array>
   44   101        INIT_FCALL                                               'floor'
        102        FETCH_DIM_R                                      ~88     !8, !15
        103        DIV                                              ~89     ~88, !1
        104        SEND_VAL                                                 ~89
        105        DO_ICALL                                         $90     
        106        FETCH_DIM_R                                      ~92     !8, !15
        107        MOD                                              ~93     ~92, !1
        108        FETCH_DIM_R                                      ~91     !0, $90
        109        FETCH_DIM_R                                      ~94     ~91, ~93
        110        ASSIGN                                                   !19, ~94
   45   111        INIT_FCALL                                               'floor'
        112        FETCH_CONSTANT                                   ~97     'j'
        113        FETCH_DIM_R                                      ~98     !8, ~97
        114        DIV                                              ~99     ~98, !1
        115        SEND_VAL                                                 ~99
        116        DO_ICALL                                         $100    
        117        ASSIGN_DIM                                               !17, 0
        118        OP_DATA                                                  $100
   46   119        FETCH_CONSTANT                                   ~102    'j'
        120        FETCH_DIM_R                                      ~103    !8, ~102
        121        MOD                                              ~104    ~103, !1
        122        ASSIGN_DIM                                               !18, 0
        123        OP_DATA                                                  ~104
   47   124        ADD                                              ~105    !15, 1
        125        ASSIGN                                                   !20, ~105
        126      > JMP                                                      ->179
   48   127    >   IS_SMALLER                                               !16, !1
        128      > JMPZ                                                     ~107, ->178
   49   129    >   ASSIGN                                                   !21, 0
        130      > JMP                                                      ->147
   50   131    >   INIT_FCALL                                               'floor'
        132        FETCH_DIM_R                                      ~109    !8, !20
        133        DIV                                              ~110    ~109, !1
        134        SEND_VAL                                                 ~110
        135        DO_ICALL                                         $111    
        136        FETCH_DIM_R                                      ~112    !17, !21
        137        IS_EQUAL                                         ~113    $111, ~112
        138      > JMPNZ_EX                                         ~113    ~113, ->144
        139    >   FETCH_DIM_R                                      ~114    !8, !20
        140        MOD                                              ~115    ~114, !1
        141        FETCH_DIM_R                                      ~116    !18, !21
        142        IS_EQUAL                                         ~117    ~115, ~116
        143        BOOL                                             ~113    ~117
        144    > > JMPZ                                                     ~113, ->146
   51   145    > > JMP                                                      ->149
   49   146    >   PRE_INC                                                  !21
        147    >   IS_SMALLER                                               !21, !16
        148      > JMPNZ                                                    ~119, ->131
   54   149    >   INIT_FCALL                                               'floor'
        150        FETCH_DIM_R                                      ~121    !8, !20
        151        DIV                                              ~122    ~121, !1
        152        SEND_VAL                                                 ~122
        153        DO_ICALL                                         $123    
        154        ASSIGN_DIM                                               !17, !16
        155        OP_DATA                                                  $123
   55   156        FETCH_DIM_R                                      ~125    !8, !20
        157        MOD                                              ~126    ~125, !1
        158        ASSIGN_DIM                                               !18, !16
        159        OP_DATA                                                  ~126
   56   160        INIT_FCALL                                               'floor'
        161        FETCH_DIM_R                                      ~127    !8, !20
        162        DIV                                              ~128    ~127, !1
        163        SEND_VAL                                                 ~128
        164        DO_ICALL                                         $129    
        165        FETCH_DIM_R                                      ~131    !8, !20
        166        MOD                                              ~132    ~131, !1
        167        FETCH_DIM_R                                      ~130    !0, $129
        168        FETCH_DIM_R                                      ~133    ~130, ~132
        169        ADD                                              ~134    !19, ~133
        170        ASSIGN                                                   !19, ~134
   57   171        PRE_INC                                                  !16
   58   172        IS_EQUAL                                         ~137    !16, !1
        173      > JMPZ_EX                                          ~137    ~137, ->176
        174    >   IS_SMALLER                                       ~138    !19, !13
        175        BOOL                                             ~137    ~138
        176    > > JMPZ                                                     ~137, ->178
   59   177    >   ASSIGN                                                   !13, !19
   47   178    >   PRE_INC                                                  !20
        179    >   IS_SMALLER                                               !20, !12
        180      > JMPNZ                                                    ~141, ->127
   40   181    >   PRE_INC                                                  !15
        182    >   SUB                                              ~143    !12, !1
        183        ADD                                              ~144    ~143, 1
        184        IS_SMALLER                                               !15, ~144
        185      > JMPNZ                                                    ~145, ->98
   35   186    >   PRE_INC                                                  !14
        187    >   IS_SMALLER                                               !14, !11
        188      > JMPNZ                                                    ~147, ->88
   67   189    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.47 ms | 1404 KiB | 23 Q