[ create a new paste ] login | about

Link: http://codepad.org/I6vSCt5o    [ raw code | output | fork ]

PHP, pasted on Jan 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php



$arr = array( '2009-1-1', '2009-2-1','2009-3-1','2009-3-1' );

$output = array();
foreach( $arr as $date ){
   $output[date('M', strtotime($date))][] = $date; 
}
print_r($output);

?>


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Array
(
    [Jan] => Array
        (
            [0] => 2009-1-1
        )

    [Feb] => Array
        (
            [0] => 2009-2-1
        )

    [Mar] => Array
        (
            [0] => 2009-3-1
            [1] => 2009-3-1
        )

)


Create a new paste based on this one


Comments: