$dp=opendir($currentdir);
while ( false != ( $file=readdir($dp) ) ) {
if (is_file($file) && $file!="." && $file!=".."){
$extention = explode(".",$file);
$extfield = count($extention)-1;
$extention = $extention[$extfield];
if( in_array($extention,$typelist) ){
array_push ($imagelist,$file);
}
}
}
By this code get all files in a folder. The list comes out in order by the date of the file.
I would order is by the file name.
I have tried
$imagelist = sort($imagelist);
But my array is empty, how I have to sort it???