I having trouble with multidimensional array. I want to get the Results based on calculate from rows and columns
I have array probabilitas like this
Array (
[0] => Array (
[0] => 0.21739130434783
[1] => 0.043478260869565
[2] => 0.23809523809524
[3] => 0.071428571428571
[4] => 0.058823529411765
[5] => 0.20833333333333
)
[1] => Array (
[0] => 0.08695652173913
[1] => 0.17391304347826
[2] => 0.095238095238095
[3] => 0.17857142857143
[4] => 0.23529411764706
[5] => 0.16666666666667
)
[2] => Array (
[0] => 0.043478260869565
[1] => 0.17391304347826
[2] => 0.095238095238095
[3] => 0.17857142857143
[4] => 0.11764705882353
[5] => 0.16666666666667
)
[3] => Array (
[0] => 0.08695652173913
[1] => 0.17391304347826
[2] => 0.19047619047619
[3] => 0.17857142857143
[4] => 0.23529411764706
[5] => 0.083333333333333
)
[4] => Array (
[0] => 0.21739130434783
[1] => 0.17391304347826
[2] => 0.19047619047619
[3] => 0.035714285714286
[4] => 0.11764705882353
[5] => 0.16666666666667
)
[5] => Array (
[0] => 0.17391304347826
[1] => 0.17391304347826
[2] => 0.095238095238095
[3] => 0.17857142857143
[4] => 0.11764705882353
[5] => 0.16666666666667
)
[6] => Array (
[0] => 0.17391304347826
[1] => 0.08695652173913
[2] => 0.095238095238095
[3] => 0.17857142857143
[4] => 0.11764705882353
[5] => 0.041666666666667
)
)
if run on browser wil be like this

and i want to get the final results like this
countCol1 = 0,94197665
countCol2 = 0,960859982
countCol3 = 0,960555517
countCol4 = 0,948500044
countCol5 = 0,953102906
countCol6 = 0,956259856
but i got error like this
Message: log() expects parameter 1 to be float, array given
what's wrong with my code ? can someone help me?
this my code
$kriteria = [C1,C2,C3,C4,C5,C6];
$alternatif = [ALT1,ALT2,ALT,ALT4,ALT5,ALT6,ALT7];
$nEntropy = array();
for ($i=0;$i<count($kriteria);$i++)
{
for ($j=0;$j<count($alternatif);$j++)
{
$nEntropy[$j][$i] =
((-1/log(7)) *
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])) +
($probabilitas[$j][$i]*log($probabilitas[$i])));
}
}
to calculate it I use this formula.
countCol1 = (-1/log(7)) * ((0,217391304*log(0,217391304))+(0,086956522*log(0,086956522))+(0,043478261*log(0,043478261))+(0,086956522*log(0,086956522))+(0,217391304*log(0,217391304))+(0,173913043*log(0,173913043))+(0,173913043*log(0,173913043)))
countCol2 = (-1/log(7)) * ((0,043478261*log(0,043478261))+(0,173913043*log(0,173913043))+(0,173913043*log(0,173913043))+(0,173913043*log(0,173913043))+(0,173913043*log(0,173913043))+(0,173913043*log(0,173913043))+(0,086956522*log(0,086956522)))
countCol3 = (-1/log(7)) * ((0,238095238*log(0,238095238))+(0,095238095*log(0,095238095))+(0,095238095*log(0,095238095))+(0,19047619*log(0,19047619))+(0,19047619*log(0,19047619))+(0,095238095*log(0,095238095))+(0,095238095*log(0,095238095)))
countCol4 = (-1/log(7)) * ((0,071428571*log(0,071428571))+(0,178571429*log(0,178571429))+(0,178571429*log(0,178571429))+(0,178571429*log(0,178571429))+(0,035714286*log(0,035714286))+(0,178571429*log(0,178571429))+(0,178571429*log(0,178571429)))
countCol5 = (-1/log(7)) * ((0,058823529*log(0,058823529))+(0,235294118*log(0,235294118))+(0,117647059*log(0,117647059))+(0,235294118*log(0,235294118))+(0,117647059*log(0,117647059))+(0,117647059*log(0,117647059))+(0,117647059*log(0,117647059)))
countCol6 = (-1/log(7)) * ((0,208333333*log(0,208333333))+(0,166666667*log(0,166666667))+(0,166666667*log(0,166666667))+(0,083333333*log(0,083333333))+(0,166666667*log(0,166666667))+(0,166666667*log(0,166666667))+(0,041666667*log(0,041666667)))
$probabilitas[$i]contains a float value. I can't find where you define$probabilitaslog($probabilitas[$i])-> the parameter will always contain an array, because$probabilitasis two-dimensional.