Hola chic@s tengo un problema y es que no puedo ordenar un txt por fecha descendente o sea la más reciente de primeras. Abro el archivo y el campo de fecha es el numero 1 del arreglo $campo[1]. Necesito ordenar este, no se como hacerlo con sort rsort ksort... como sería
Código:
<?php
echo "<br><br><table border=1 cellspacing=5 width=1510 class='order-table table'>
<thead
<tr>
<th>Estado</th>
<th>Telefono</th>
<th>Punto de Venta</th>
<th>Cliente</th>
<th>Direccion</th>
<th>Hora Pedido</th>
<th>Valor</th>
<th>Agente</th>
<th>Cierre Pedido</th>
</tr>
</thead>";
@$fp = fopen("C:\usr\Final.txt", "r") or die("Error al abrir archivo");
// echo "Termino Lectura";
while(!feof($fp)) {
$linea=fgets($fp);
$linea=trim(str_replace("'", "",$linea));
$campos=explode(",",$linea);
$fecha = $campos[1];
$Nombre = $campos[4].' '.$campos[5];
echo "<tbody>
<tr>
<td>$campos[3]</td>
<td>$campos[0]</td>
<td>$campos[2]</td>
<td>$campos[4] $campos[5]</td>
<td>$campos[6] $campos[7]</td>
<td>$campos[1]</td>
<td>$$campos[8]</td>
<td>$campos[13]</td>
<td>$campos[14]</td>
<td>$campos[9]</td>
<td>$campos[10]</td>
<td>$campos[11]</td>
</tr>
</tbody>";
}
fclose($fp);
echo "</table>";
?>
<div id="Foot"><center><p>No hay más resultados</p></center></div>
</body>
</html>
Si me pueden ayudar agradecería su colaboración