<?php
  //funciones usadas


 


  function ordenarIndice($a){
    $return = array();
    foreach($a as $k => $v){
      //$v['eliminar'] = '0';
      array_push($return, $v);
    }
    return $return;
  }

  function build_table($array, $chk = true){
    // start table
    $html = '<table class="table table-striped table-bordered table-hover">';
    // header row
    $html .= '<tr>';
    foreach($array[0] as $key=>$value){
            $html .= '<th>' . $key . '</th>';
        }
    if($chk)
      $html .= '<th>Eliminar</th>';
    $html .= '</tr>';

    // data rows
    $i = 0;
    foreach( $array as $key=>$value){
      $html .= '<tr>';
      foreach($value as $key2=>$value2){
          $html .= '<td>' . $value2 . '</td>';
      }
      if($chk)
        $html .= '<td><input type="checkbox" name="Aeliminar[]" value="' . $i . '"/></td>'; 
      $html .= '</tr>';
      $i++;
    }

    // finish table and return it

    $html .= '</table>';
    return $html;
  }