title: Create and sort new array by time
body: <p>I have an array similar to this</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [showname] =&gt; White Collar
              [air_time] =&gt; 1310590800
          )
  
      [1] =&gt; Array
          (
              [showname] =&gt; Chopped
              [air_time] =&gt; 1310590800
          )
  
      [2] =&gt; Array
          (
              [showname] =&gt; Covert Affairs
              [air_time] =&gt; 1310587200
          )
      } ... etc
  </code></pre>
  
  <p>I want to crete a new array that is sorted by air_time. for example all shows containing the same air_time should be in [0] then [1] then [2] etc..</p>
  
  <p>An example of the output i would like is this:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [time] =&gt; 1310590800
              [shows] =&gt; Array
                  (
                      [name] =&gt; White Collar
                      [name] =&gt; Chopped
                  )
  
          )
  
      [1] =&gt; Array
          (
              [time] =&gt; 1310587200
              [shows] =&gt; Array
                  (
                      [name] =&gt; Covert Affairs
                  )
  
          )
  }
  </code></pre>
  
  <p>I've been looking at different array methods like multisort but i wasn't able to figure it out.</p>
  
  <p>Could you point me in the right direction? thanks</p>
  
  <p><strong>update</strong> i know how to sort the array normally by time, i just dont know how can i separate and group elements that have the same time</p>