Reverse table head using views 3.x

<?php
/**
 * @file views-view-table.tpl.php
 * Template to display a view as a table.
 *
 * - $title : The title of this group of rows.  May be empty.
 * - $header: An array of header labels keyed by field id.
 * - $header_classes: An array of header classes keyed by field id.
 * - $fields: An array of CSS IDs to use for each field id.
 * - $classes: A class or classes to apply to the table, based on settings.
 * - $row_classes: An array of classes to apply to each row, indexed by row
 *   number. This matches the index in $rows.
 * - $rows: An array of row items. Each row is an array of content.
 *   $rows are keyed by row number, fields within rows are keyed by field ID.
 * - $field_classes: An array of classes to apply to each field, indexed by
 *   field id, then row number. This matches the index in $rows.
 * @ingroup views_templates
 */
$row = array();
foreach ($rows as $col){
  foreach ($col as $ltr => $value){
    $row[$ltr][] = $value;
  }
}
$element = 'odd';
?>
<table <?php if ($classes) { print 'class="'. $classes . '" '; } ?><?php print $attributes; ?>>
  <?php if (!empty($title)) : ?>
    <caption><?php print $title; ?></caption>
  <?php endif; ?>
  <tbody>
  <?php foreach ($row as $field => $rowname):?>
    <tr class="<?php echo $element; ?>">
      <td><?php echo strip_tags($header[$field]); ?></td>
      <?php foreach($rowname as $count => $item): ?>
        <td><?php echo $item; ?></td>
      <?php endforeach; ?>
    </tr>
    <?php $element == 'odd' ? $element = 'even' : $element = 'odd'; ?>
  <?php endforeach; ?>
  </tbody>
</table>

 

********************************** ************************* ************************ **************** ****************** *********** ************** ************* ************ *************