Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
37 | public static function sum(...$arrays): array |
||
38 | { |
||
39 | $sum = []; |
||
40 | |||
41 | foreach ($arrays as $array) { |
||
42 | foreach ($array as $index => $value) { |
||
43 | if (! array_key_exists($index, $sum)) { |
||
44 | $sum[$index] = $value; |
||
45 | } else { |
||
46 | $sum[$index] += $value; |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $sum; |
||
52 | } |
||
54 |