Hi everyone I am a new newbie in php. I tried so many things to do this but i cant get the desired output. 
This is my array i Want to to sort the array and count the number of month in the array and also count the data occurrence in the array after push all the data to new array according to the months,no. of data count,Key pairs. 

```
    Array
(
    [0] => Array
        (
            [comp_date] => 2015/07/23 06:20
            [comp_status] => Lead
        )

    [1] => Array
        (
            [comp_date] => 2015/07/23 06:20
            [comp_status] => Lead
        )

    [2] => Array
        (
            [comp_date] => 2015/07/23 06:20
            [comp_status] => Opportunity
        )

    [3] => Array
        (
            [comp_date] => 2015/07/24 06:20
            [comp_status] => Conversion
        )

    [4] => Array
        (
            [comp_date] => 2015/07/24 06:20
            [comp_status] => Lead
        )

    [5] => Array
        (
            [comp_date] => 2015/08/24 06:20
            [comp_status] => Opportunity
        )

    [6] => Array
        (
            [comp_date] => 2015/08/24 06:20
            [comp_status] => Conversion
        )

    [7] => Array
        (
            [comp_date] => 2015/07/25 06:20
            [comp_status] => Lead
        )

    [8] => Array
        (
            [comp_date] => 2015/06/25 06:20
            [comp_status] => Opportunity
        )

    [9] => Array
        (
            [comp_date] => 2015/08/25 06:20
            [comp_status] => Conversion
        )

    [10] => Array
        (
            [comp_date] => 2015/08/25 06:20
            [comp_status] => Lead
        )
)

```

This is my actual array.
I had tired this 

```
function yearWiseCalculation(){
$query = mysql_query("SELECT comp_date,comp_status FROM `hr_companies` WHERE  year(comp_date)=year(curdate())");
$arr =[];
while ($total = mysql_fetch_assoc($query)) {

    array_push($arr,$total);
    $ex = explode(" ", $total['comp_date']);
    $ex = explode(" ", $ex[0]);
    $k = explode("/", $ex[0]);
    $time[]=strtotime($ex[0]);
    $month[]=date("F",$time[0]);
}

```

I want Output in This Form are given Below

```
 Array(
       [0] => Array
        (
            [comp_month] => july
            [lead] => 4
            [opportunity] => 1
            [conversion] => 1
        )
      [1] => Array
        (
            [comp_month] => August
            [lead] => 1
            [opportunity] => 1
            [conversion] => 2
        )

)

```