Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #add #array #values #keys
ADD COMMENT
Topic
Name
5+3 =