title: Group array element by other elements
body: <p>I have an Array containing arrays with 8 values, I want to group date element having same <code>teacher_name</code>, <code>school_name</code> and <code>month_year</code>. The date element will be an array according same teacher name, school and month and year combination.</p>
  
  <p>Below is the whole array which need to filter:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Jun 16
              [starttime] =&gt; 04:04 PM
              [endtime] =&gt; 05:04 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 09
          )
  
      [1] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Jun 16
              [starttime] =&gt; 04:04 PM
              [endtime] =&gt; 05:04 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 12
          )
  
      [2] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:08 PM
              [endtime] =&gt; 05:08 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 01
          )
  
      [3] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:08 PM
              [endtime] =&gt; 05:08 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 02
          )    
  
      [4] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 2
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:08 PM
              [endtime] =&gt; 05:08 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 11
          )
  
      [5] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 2
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:08 PM
              [endtime] =&gt; 05:08 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; 22
          )
  )   
  </code></pre>
  
  <p>I want like below:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Jun 16
              [starttime] =&gt; 04:04 PM
              [endtime] =&gt; 05:04 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; Array(09, 12) 
          )
      [1] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 1
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:04 PM
              [endtime] =&gt; 05:04 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; Array(01, 02)
          )
      [3] =&gt; Array
          (
              [teacher_name] =&gt; CF
              [school_name] =&gt; School 2
              [month_year] =&gt; Oct 16
              [starttime] =&gt; 04:04 PM
              [endtime] =&gt; 05:04 PM
              [total_minutes] =&gt; 60
              [teacher_rate] =&gt; 20
              [date] =&gt; Array(11, 22)
          )
  
  )       
  </code></pre>