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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.98 ms | 1417 KiB | 23 Q