Count on multidimensional array


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

Hi, i got an array as below:

Array
(
Did you know?Explore Trending and Topic pages for more stories like this.
=> 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
No comments posted yet

Your Answer:

Login to answer
52 Like 44 Dislike
Previous forums Next forums
Other forums

how to get IP address?
hey guys,

i have this code which is supposed to get me the IP address of my site visitors:

Is there something wrong?
Hi all,

Just a quick question... can someone look at this code and see if something is wrong?

Search in the PHP Files
have to search asterisk(*) in the php code of the php files .
In the html page one text box

Class not found error
I am getting Class 'index' not found in Eval function:

//write config

$pat

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

Need help-Error istream header declaration
Hi Everyone ,

I am having issue with istream declaration. I am new to C programming.
can a

Having a problem get the selected item from a drop down menu
I have been looking at this for days now.

I have a drop down menu that get it's values from a

MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text) 1. SQL = "UPDATE sampletable SET column1 = 'C1sample1'"

Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:

2010-01-26 and 2010-05-30

Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba

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