Count on multidimensional array


Posted on 16th Feb 2014 07:03 pm by admin

Hi, i got an array as below:

Array
(
=> Array
(
[2009-12-08] => 1
)
[1] => Array
(
[2009-12-07] => 1
)
[2] => Array
(
[2009-12-04] => 1
)
[3] => Array
(
[2009-12-03] => 10
)
[4] => Array
(
[2009-12-02] => 10
)
[5] => Array
(
[2009-12-01] => 10
)
[6] => Array
(
[2009-12-10] => 6
)
[7] => Array
(
[2009-12-08] => 5
)
[8] => Array
(
[2009-12-07] => 10
)
[9] => Array
(
[2009-12-04] => 1
)
[10] => Array
(
[2009-12-02] => 3
)
[11] => Array
(
[2009-12-01] => 10
)
)

i would like to do a sum on each date, and generate the below array:

Array
(
=> Array
(
[2009-12-10] => 6
)
[1] => Array
(
[2009-12-08] => 6
)

[2] => Array
(
[2009-12-07] => 11
)

[3] => Array
(
[2009-12-04] => 2
)

[4] => Array
(
[2009-12-03] => 10
)

[6] => Array
(
[2009-12-02] => 13
)

[6] => Array
(
[2009-12-01] => 20
)
)

Any idea? Thanks

52 Like 44 Dislike
Previous php-forum Next php-forum
Other php-forum

using explode() to fill in checkboxes
Hi

I have a field stored in a table that contains regions in the UK separated by commas. Ther

sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

Multiple arrays inside data
Hi,

Simple question. I have a column called "array" in my database, and inserted in

Working with popups and such in a class
I've recently started building my applications completely enclosed in classes. I like the fact that

FFmpeg Images 2 Video conversion problem ??
I got folder full of images , number of images = 600 , I want to make a video which plays one image

Fetching META TAGS through
Hello everybody
I want to fetch meta tags of a domain.
It will be done from following code of

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

Need understanding of this bit of code
Code: <?php
// WHERE clause filters
$arrSQLFilters = array();

//

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash