title: How to sort an array of times chronologically?
body: <p>I have a non-associative array where the data that comes in is not sorted (I'm receiving the data from an outside system and cannot force it to come into the array in sorted order.) Is there any way to sort the values? I've tried this:</p>
  
  <pre><code>$wedTrackTimes = array("9:30 AM-10:30 AM", "8:15 AM-9:15 AM", "12:30 PM-1:30 PM", "2:00 PM-3:00 PM", "3:30 PM-4:30 PM");
  $wedTrackTimes = array_unique($wedTrackTimes);
  $wedTrackTimes = sort($wedTrackTimes);
  print_r($wedTrackTimes);
  </code></pre>
  
  <p>But instead of returning a sorted array, it returns 1. I'm assuming it's because it's non-associative, so there are no keys. Is there any way to sort an array by value only? We really need the 9:30 AM time slot to fall after the 8:15 AM slot, as it should.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to all for the answers; that did make the array sort, but not as expected. If I use the default sort type, I get this:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 12:30 PM-1:30 PM
      [1] =&gt; 2:00 PM-3:00 PM
      [2] =&gt; 3:30 PM-4:30 PM
      [3] =&gt; 8:15 AM-9:15 AM
      [4] =&gt; 9:30 AM-10:30 AM
  )
  </code></pre>
  
  <p>Using SORT_NUMERIC I get this:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 2:00 PM-3:00 PM
      [1] =&gt; 3:30 PM-4:30 PM
      [2] =&gt; 8:15 AM-9:15 AM
      [3] =&gt; 9:30 AM-10:30 AM
      [4] =&gt; 12:30 PM-1:30 PM
  )
  </code></pre>
  
  <p>Using SORT_STRING I get this:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 12:30 PM-1:30 PM
      [1] =&gt; 2:00 PM-3:00 PM
      [2] =&gt; 3:30 PM-4:30 PM
      [3] =&gt; 8:15 AM-9:15 AM
      [4] =&gt; 9:30 AM-10:30 AM
  )
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 8:15 AM-9:15 AM
      [1] =&gt; 9:30 AM-10:30 AM
      [2] =&gt; 12:30 PM-1:30 PM
      [3] =&gt; 2:00 PM-3:00 PM
      [4] =&gt; 3:30 PM-4:30 PM
  
  
  )
  </code></pre>
  
  <p>Is this possible?</p>