title: Array Formatting PHP
body: <p>This is my code in php. </p>
  
  <pre><code>$approveddata=  "SELECT DATE AS DATE, company_id, count As Approved
                              FROM tbl_summary_order
                              WHERE DATE &gt;= DATE( NOW( ) ) - INTERVAL 7 
                              DAY AND STATUS =4
                              GROUP BY company_id, DATE( DATE ) 
                                  ORDER BY DATE ASC "
  
  while ($_row = $rsqueryapproveddata-&gt;read()) {
  
      $list1[$_row['DATE']][$_row['company_id']] = $_row['Approved'];
  }
  </code></pre>
  
  <p>I am getting the output as              </p>
  
  <pre><code> "data": {
      "2018-01-30": { "1": "10",   "2": "5" },
      "2018-01-31": {     "1": "10" }
  }
  </code></pre>
  
  <p>But I need a format 'to add the date inside every inner array.      </p>
  
  <p>Some thing like the below format </p>
  
  <pre><code>data: [{ date: '2018-01-30', 1: 10, 2: 5, }, { date: '2018-01-31', 1: 10 } 
  </code></pre>