Jump to content

Do a count of a multidimensional array


GaRd3NiA

Recommended Posts

Hi, i have an array as below :

Array

(

    [0] => Array

        (

            [time] => 2009-12-08

            [count] => 1

        )

 

    [1] => Array

        (

            [time] => 2009-12-03

            [count] => 2

        )

 

    [2] => Array

        (

            [time] => 2009-12-03

            [count] => 9

        )

 

    [3] => Array

        (

            [time] => 2009-12-03

            [count] => 1

        )

 

    [4] => Array

        (

            [time] => 2009-12-02

            [count] => 10

        )

 

    [5] => Array

        (

            [time] => 2009-12-02

            [count] => 10

        )

 

 

    [6] => Array

        (

            [time] => 2009-11-30

            [count] => 10

        )

    [7] => Array

        (

            [time] => 2009-11-27

            [count] => 10

        )

)

 

Any idea on how to find the total count in each day?

 

Thanks in advance!!!

 

Jason

Link to comment
https://forums.phpfreaks.com/topic/185572-do-a-count-of-a-multidimensional-array/
Share on other sites

Thanks for your kind reply teynon.

Sorry not to mention in the first post, actually i would like to have the output as below:

 

Array

  [0] => Array

        (

            [time] => 2009-12-08

            [count] => 1

        )

    [1] => Array

        (

            [time] => 2009-12-03

            [count] => 12 <-- the sum of count in 2009-12-03

        )

    [2] => Array

        (

            [time] => 2009-12-02

            [count] => 20 <-- the sum of count in 2009-12-02

        )

    [3] => Array

        (

            [time] => 2009-11-30

            [count] => 10

        )

    [4] => Array

        (

            [time] => 2009-11-27

            [count] => 10

        )

)

 

 

Thanks!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.