I have two different arrays:
$dep = Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 2 [4] => 3 [5] => 3 )
and
$q1_a = Array ( [0] => 4 [1] => 4 [2] => 4 [3] => 2 [4] => 4 [5] => 2 )
I put it in one array:
$arr = array($dep, $q1_a);
And then I got:
Array (
[0] => Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 2 [4] => 3 [5] => 3 )
[1] => Array ( [0] => 4 [1] => 4 [2] => 4 [3] => 2 [4] => 4 [5] => 2 ) )
How can I summarize variables of second array where it matches specific number in first. So I need to find sum of numbers where first array has 1,2 and 3. And to get 3 different numbers.
so first number will be:
[0] => 1 [1] => 1 [2] => 1
[0] => 4 [1] => 4 [2] => 4
4+4+4=12
second:
[3] => 2
[3] => 2
2
third:
[4] => 3 [5] => 3
[4] => 4 [5] => 2
4+2=6
How can I do that?