View Single Post
Old 03-07-2004, 01:52 PM   #4 (permalink)
DonnChadh
Tilted
 
Location: Tha Boro
This snippet sorts an array of file references by the last changed date of the file by retriving an array of dates and then using array_multisort to sort the array of filenames by the array of dates

PHP Code:
  if ($galFiles != NULL) {
    
sort ($galFiles);
    
reset ($galFiles);

    if (
$filesort == "chrono") {
      
//Sort the images chronologically
      
foreach ($galFiles as $file) {
        
$fileloc getcwd() . "/" $path_to_imgs $currDir $file;
        
$galfilemod[] = filectime($fileloc);
      }
      
reset ($galFiles);
      
array_multisort($galfilemodSORT_DESC$galFiles) ;
      
reset ($galFiles);
    }
  } 
__________________
I try to take life one day at a time, but sometimes several days attack me at once.
DonnChadh is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76