note 76198 deleted from function.sort by cmb
| From: | cmb@php.net | Date: | Sun, 27 Oct 2019 08:35:15 +0000 |
| Subject: | note 76198 deleted from function.sort by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212789@lists.php.net to get a copy of this message | ||
Note Submitter: NBS Studio
----
This is my way of sorting files into date modified date order. It worked for me!
$dir='topics';
$ext='php5';
$files=scandir($dir);
foreach($files as $fs){
if(($fs!='.')&&($fs!='..')){
$fs1.='¬'.filemtime($dir.'/'.$fs).'#'.$fs;
}
}
$fs2=split('[¬]',$fs1);
arsort($fs2);
foreach($fs2 as $fs3){
if(eregi($ext,$fs3)){
$fs4.='¬'.$fs3;
}
}
$fs5=split('[#]',$fs4);
foreach($fs5 as $fs6){
if(eregi($ext,$fs6)){
$fs7.='¬'.$fs6;
}
}
$fs8=split('[¬]',$fs7);
foreach($fs8 as $fs9){
$file_list.=$fs9.'
</br>';
}
print $file_list;