title: Help sorting keys
body: <p>I need help sorting <code>[Time]</code> data from in this array in php. For a given day, the time is NOT in order.
  Is there a way to sort this? Thanks.</p>
  
  <pre><code>Array ( [0] =&gt; Array ( )
  [1] =&gt; Array (         
                 [Server] =&gt; server1.name 
                 [Date] =&gt; Sun Aug 22 2010         
                 [Set] =&gt; db2.bak_lvm         
                 [Time] =&gt; 06:00:02         
                 [Duration] =&gt; 01:28:12         
                 [Size] =&gt; 72.05 GB         
                 [Status] =&gt; Succeeded ) 
  [2] =&gt; Array ( [Server] =&gt; server1.name                
                 [Date] =&gt; Sun Aug 22 2010 
                 [Set] =&gt; db2.bak_lvm 
                 [Time] =&gt; 00:00:03 
                 [Duration] =&gt; 01:49:37 
                 [Size] =&gt; 187.24 GB 
                 [Status] =&gt; Succeeded ) 
  [3] =&gt; Array ( [Server] =&gt; server1.name 
                 [Date] =&gt; Sun Aug 22 2010 
                 [Set] =&gt; db3.bak_lvm 
                 [Time] =&gt; 23:00:03 
                 [Status] =&gt; Unsuccessful ) 
  [4] =&gt; Array ( [Server] =&gt; server1.name 
                 [Date] =&gt; Sun Aug 22 2010 
                 [Set] =&gt; db4.bak_lvm  
                 [Time] =&gt; 04:00:03 
                 [Duration] =&gt; 00:42:36 
                 [Size] =&gt; 46.46 GB 
                 [Status] =&gt; Succeeded ) 
  </code></pre>
  
  <p>Here's my php code, thus far:</p>
  
  <pre><code>&lt;?php
  $data = array();
  $InputFile = file("test.txt");
  foreach ($InputFile as $line){
      preg_match_all("/([0-9])-([^=]+)=([^;]+);/", $line, $matches, PREG_SET_ORDER);
  
      $LineData = array();
      foreach ($matches as $information)
         $LineData[$information[2]] = $information[3];
         $data[] = $LineData;
  }
      $keys = array('Server', 'Date','Set','Time','Duration','Size','Status');
          echo '&lt;table id="stats"&gt;&lt;tr&gt;';
          foreach ($keys as $column)
             echo '&lt;th&gt;' . $column . '&lt;/th&gt;';
              echo '&lt;/tr&gt;';
  
          $counter=0;
          foreach ($data as $row){
             $counter ++;
             $class = $counter % 2 === 0 ? 'alt1' : 'alt2';
             echo '&lt;tr class="' . $class . '"&gt;';
  
               foreach ($keys as $column)
                  if (isset($row[$column])){
                    echo '&lt;td&gt;' . $row[$column];
                    } else {
                    echo '&lt;td&gt;' . '' . '&lt;/td&gt;';
                  }
          }
          echo '&lt;/table&gt;';
          print_r($data);
  ?&gt;
  </code></pre>
  
  <p><strong>Updated</strong>: Latest sort after using suggested fix by Bill. <code>[Time]</code> is in order, but also need to have it sorted within <code>[Date]</code></p>
  
  <pre><code>Array ( [0] =&gt; Array (
              [Server] =&gt; server1.name
              [Date] =&gt; Mon Aug 23 2010
              [Set] =&gt; db2.bak_lvm
              [Time] =&gt; 00:00:03
              [Duration] =&gt; 01:50:24
              [Size] =&gt; 187.24 GB
              [Status] =&gt; Succeeded )
      [1] =&gt; Array ( [Server] =&gt; server1.name
                     [Date] =&gt; Mon Aug 23 2010
                     [Set] =&gt; db3.bak_lvm
                     [Time] =&gt; 04:00:02
                     [Duration] =&gt; 00:42:28
                     [Size] =&gt; 46.47 GB
                     [Status] =&gt; Succeeded )
      [2] =&gt; Array ( [Server] =&gt; server1.name
                     [Date] =&gt; Sun Aug 22 2010
                     [Set] =&gt; db3.bak_lvm
                     [Time] =&gt; 04:00:03
                     [Duration] =&gt; 00:42:36
                     [Size] =&gt; 46.46 GB
                     [Status] =&gt; Succeeded )
      [3] =&gt; Array ( [Server] =&gt; server1.name
                     [Date] =&gt; Mon Aug 23 2010
                     [Set] =&gt; db1.bak_lvm
                     [Time] =&gt; 06:00:02
                     [Duration] =&gt; 01:28:24
                     [Size] =&gt; 72.05 GB
                     [Status] =&gt; Succeeded )
      [4] =&gt; Array ( [Server] =&gt; server1.name
                     [Date] =&gt; Sun Aug 22 2010
                     [Set] =&gt; db4.bak_lvm
                     [Time] =&gt; 20:00:03
                     [Duration] =&gt; 04:17:57
                     [Size] =&gt; 426.60 GB
                     [Status] =&gt; Succeeded )
  </code></pre>