title: count array element with specific condition
body: <p>I have an array.
  Now its a json array:</p>
  
  <pre><code>{
    "status":"OK",
    "details":{
      "Jun":[
        {
          "id":"8",
          "order_id":"0",
          "client_id":"0",
          "driver_id":"3",
          "status":"accept",
          "order_date":"2017-06-22"
        },
        {
          "id":"13",
          "order_id":"1",
          "client_id":"0",
          "driver_id":"3",
          "status":"accept",
          "order_date":"2017-06-22"
        },
        {
          "id":"33",
          "order_id":"1",
          "client_id":"0",
          "driver_id":"3",
          "status":"decline",
          "order_date":"2017-06-22"
        }
      ],
      "Apr":[
        {
          "id":"7",
          "order_id":"12",
          "client_id":"15",
          "driver_id":"3",
          "status":"accept",
          "order_date":"2014-04-10"
        }
      ]
    }
  }
  </code></pre>
  
  <p>My data show as monthly now.</p>
  
  <p>I want to show array monthly but calculate <code>total accepted</code>, <code>total request</code>, <code>total decline</code>.</p>
  
  <p>My expected Output look like:</p>
  
  <pre><code>{
    "status":"OK",
    "details":{
      "Jun":[
        {
          "total accepted":"2",
          "total decline":"1",
          "total request":"3"
        }
      ],
      "Apr":[
        {
          "total accepted":"1",
          "total decline":"0",
          "total request":"1"
        }
      ]
    }
  }
  </code></pre>
  
  <p>My Current PHP CODE is:</p>
  
  <pre><code>while ($row = mysql_fetch_assoc($result))
  {
    $details_sort[] = $row;
  }
  
  $monthlyDetails = array();
  
  foreach ($details_sort as $detail)
  {
    $monthName = date('M', strtotime($detail['order_date']));
  
    if (! array_key_exists($monthName, $monthlyDetails) )
    {  
      $monthlyDetails[$monthName] = array();
    }
  
    array_push($monthlyDetails[$monthName], $detail);             
  }
  </code></pre>
  
  <p>I can not understand how to calculate <code>total accepted</code>, <code>total request</code>, <code>total decline</code>. Please give me some example.</p>