how to sum array items, vertically?
| From: | Sigurd | Date: | Tue, 22 Jan 2002 13:28:27 +0000 |
| Subject: | how to sum array items, vertically? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81626@lists.php.net to get a copy of this message | ||
Assuming my array of this variety:
array(
"Monday" => 1, 4, 1, 0,
"Tuesday" => 5, 0, 0, 0,
"Sunday" => 2, 2, 3, 1);
How do I sum, vertically, the numbers; short of traversing thru the array
and doing it manually ? I thought about doing a array_flip() but that didnt
work. I want this:
array(
1 => 7,
2 => 6,
3 => 4,
4 => 1);
Siggy