Ver Mensaje Individual
  #10 (permalink)  
Antiguo 13/03/2014, 11:32
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 10 meses
Puntos: 379
Respuesta: Enlistar archivos por fechas

Si te interesa orientado a objetos puedes hacer uso de FileSystemIterator:
Código PHP:
Ver original
  1. $iterable = new FilesystemIterator(dirname(__FILE__));
  2. foreach ($iterable as $fileinfo) {
  3.     if(!$fileinfo->isDir()){
  4.         $array[$fileinfo->getMTime()] = $fileinfo->getFilename();
  5.     }
  6. }
  7.  
  8. krsort($array);
  9.  
  10. foreach($array as $k => $v){
  11.     $date = new DateTime();
  12.     $date->setTimestamp($k);
  13.     echo "{$date->format('Y-m-d')} --> $v" .'<br>';
  14. }
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.