title: How to sort a date array in PHP
body: <p>I have an array in this format:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [28th February, 2009] =&gt; 'bla'
          )
  
      [1] =&gt; Array
          (
              [19th March, 2009] =&gt; 'bla'
          )
  
      [2] =&gt; Array
          (
              [5th April, 2009] =&gt; 'bla'
          )
  
      [3] =&gt; Array
          (
              [19th April, 2009] =&gt; 'bla'
          )
  
      [4] =&gt; Array
          (
              [2nd May, 2009] =&gt; 'bla'
          )
  
  ) 
  </code></pre>
  
  <p>I want to sort them out in the ascending order of the dates (based on the month, day, and year). What's the best way to do that?</p>
  
  <p>Originally the emails are being fetched in the MySQL date format, so its possible for me to get the array in this state:</p>
  
  <pre><code>Array
  [
      ['2008-02-28']='some text',
      ['2008-03-06']='some text'
  ]
  </code></pre>
  
  <p>Perhaps when its in this format, I can loop through them, remove all the <code>'-'</code> (hyphen) marks so they are left as integars, sort them using <code>array_sort()</code> and loop through them yet again to sort them? Would prefer if there was another way as I'd be doing 3 loops with this per user.</p>
  
  <p>Thanks.</p>
  
  <p>Edit: I could also do this:</p>
  
  <pre><code>$array[$index]=array('human'=&gt;'28 Feb, 2009',
                     'db'=&gt;'20080228',
                     'description'=&gt;'Some text here');
  </code></pre>
  
  <p>But using this, would there be any way to sort the array based on the 'db' element alone?</p>
  
  <p>Edit 2: Updated initial var_dump</p>