I have this multidimensional array with for loop that I use to breakdown certain number in a function.
However I'd also like to use array_diff_assoc() to get the differences.
for ($i1 = 0; $i1 <= 9; $i1++) {
$scale_0_to_9[$i1];
foreach($splitInThreeArray as $key=>$value) {
if(strlen($value) != '3') {
$value = '';
$scale_0_to_9[$key]['9'] = $value;
$scale_0_to_9[$key]['8'] = $value;
$scale_0_to_9[$key]['7'] = $value;
$scale_0_to_9[$key]['6'] = $value;
$scale_0_to_9[$key]['5'] = $value;
$scale_0_to_9[$key]['4'] = $value;
$scale_0_to_9[$key]['3'] = $value;
$scale_0_to_9[$key]['2'] = $value;
$scale_0_to_9[$key]['1'] = $value;
$scale_0_to_9[$key]['0'] = $value;
}else {
$num_0 = substr_count($value,'0');
$num_1 = substr_count($value,'1');
$num_2 = substr_count($value,'2');
$num_3 = substr_count($value,'3');
$num_4 = substr_count($value,'4');
$num_5 = substr_count($value,'5');
$num_6 = substr_count($value,'6');
$num_7 = substr_count($value,'7');
$num_8 = substr_count($value,'8');
$num_9 = substr_count($value,'9');
$scale_0_to_9[$key]['9'] = $num_9;
$scale_0_to_9[$key]['8'] = $num_8;
$scale_0_to_9[$key]['7'] = $num_7;
$scale_0_to_9[$key]['6'] = $num_6;
$scale_0_to_9[$key]['5'] = $num_5;
$scale_0_to_9[$key]['4'] = $num_4;
$scale_0_to_9[$key]['3'] = $num_3;
$scale_0_to_9[$key]['2'] = $num_2;
$scale_0_to_9[$key]['1'] = $num_1;
$scale_0_to_9[$key]['0'] = $num_0;
}
}
}
I have this, but it doesn't work.
array_diff_assoc(
$scale_0_to_9['0'], $scale_0_to_9['1'],
$scale_0_to_9['2'], $scale_0_to_9['3'],
$scale_0_to_9['4'], $scale_0_to_9['5']
)
I'm trying to compare the arrays inside $scale_0_to_9
and find at least 2 that have the most similarities.
But it doesn't have to be $scale_0_9['0']
as a starting point.
If for example $scale_0_9['2']
!= $scale_0_9['8']
have different values that would work as well.
As long as they don't have the same values.
And I need to know the ['2'] $key
because I need to match the two that have different values together.