Filtering a PHP array containing dates into a yearly summary

Posted by privateace on Stack Overflow See other posts from Stack Overflow or by privateace
Published on 2010-03-14T11:37:55Z Indexed on 2010/03/14 11:45 UTC
Read the original article Hit count: 249

Filed under:
|
|

I'm looking at a way to create a summary of transactions within a certain month based on the contents of a PHP array.

Intended outcome (excusing layout):

-------------------------------------------
|   December 2009    |         12         |
|   January  2010    |         02         |
|   February 2010    |         47         |
|   March    2010    |         108        |
|   April    2010    |         499        |
-------------------------------------------

Based on my array:

Array
(
    [0] => Array
        (
            [name] => 2009-10-23
            [values] => Array
                (
                    [0] => INzY2MTI4ZWM4OGRm
                )

        )

    [1] => Array
        (
            [name] => 2009-10-26
            [values] => Array
                (
                    [0] => IYmIzOWNmMmU3OWQz
                )

        )

    [2] => Array
        (
            [name] => 2009-11-23
            [values] => Array
                (
                    [0] => INTg4YzgxYWU1ODkx
                    [1] => IMjhkNDZkY2FjNDhl
                )

        )

    [3] => Array
        (
            [name] => 2009-11-24
            [values] => Array
                (
                    [0] => INTg4YzgxYWU1ODkx
                    [1] => INTg4YzgxYWU1ODkx
                )

        )

    [4] => Array
        (
            [name] => 2009-12-01
            [values] => Array
                (
                    [0] => IMWFiODk5ZjU1OTFk
                )

        )

I've had absolutely no luck no matter what I've tried. Especially with adding months that do not contain any variables.

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays