php add array values with same keys

Solutions on MaxInterview for php add array values with same keys by the best coders in the world

showing results for - "php add array values with same keys"
Ingrid
05 Jun 2020
1$sumArray = array();
2
3foreach ($myArray as $k=>$subArray) {
4  foreach ($subArray as $id=>$value) {
5    $sumArray[$id]+=$value;
6  }
7}
8
9print_r($sumArray);
10