title: How to return multiple arrays from a function in codeigniter?
body: <p>I am having this function in my controller.</p>
  
  <pre><code>function get_data($year, $month) {
  
          $query = $this-&gt;db-&gt;select('date,name,type')-&gt;from('books')-&gt;like('date', "$year-$month", 'after')-&gt;get();
          $data = array();
          $data2 = array();
          $data3 = array();
  
  
          foreach ($query-&gt;result() as $row) {
              if ($row-&gt;name == 'AA' &amp;&amp; $row-&gt;type == 'AM') {
                  $data[substr($row-&gt;date, 8, 2)] = '&lt;div class="aa_am"&gt;' . $row-&gt;name . ' ' . $row-&gt;type . '&lt;/div&gt;';
              } else if ($row-&gt;name == 'AA' &amp;&amp; $row-&gt;type == 'PM') {
                  $data2[substr($row-&gt;date, 8, 2)] = '&lt;div class="aa_pm"&gt;' . $row-&gt;name . ' ' . $row-&gt;type . '&lt;/div&gt;';
              } else if ($row-&gt;name == 'BB' &amp;&amp; $row-&gt;type == 'AM') {
                  $data3[substr($row-&gt;date, 8, 2)] = '&lt;div class="bb_am"&gt;' . $row-&gt;name . ' ' . $row-&gt;type . '&lt;/div&gt;';
              } 
          }
          return $data;
      }
  </code></pre>
  
  <p>I want to retrieve all data which is in $data,$data1 and $data2 at the same time. Is it possible to do it?? If anyone have an idea it would be a help for me. </p>