Answers for "php add array values with same keys"

PHP
1

php add array values with same keys

$sumArray = array();

foreach ($myArray as $k=>$subArray) {
  foreach ($subArray as $id=>$value) {
    $sumArray[$id]+=$value;
  }
}

print_r($sumArray);
Posted by: Guest on June-11-2021

Code answers related to "php add array values with same keys"

Browse Popular Code Answers by Language