First off, what is this?
print_r (sort_files(".", SRT_ACCESSED, ORDER_ASCENDING, 7));
print_r (sort_files(".", SRT_MODIFIED, ORDER_DESCENDING, 6));
print_r (sort_files(".", SRT_ALPHA, ORDER_ASCENDING, 5));
print_r (sort_files(".", SRT_CREATED, ORDER_DESCENDING, 4));
I don't think we need this, especially because it looks at the files contained in the folder where the script is launched from and NOT at the files in the folder contained in the $dir variable...
Also you said it is safe to remove the lower case conversion but if I comment this line:
$array_sort[$path] = strtolower($value); // convert the data to lowercase for names
I get this:
Warning: Wrong datatype in asort() call in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 61
Warning: First argument to array_keys() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 70
Warning: First argument to array_slice() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 73
Warning: Wrong datatype in arsort() call in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 66
Warning: First argument to array_keys() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 70
Warning: First argument to array_slice() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 73
Warning: Wrong datatype in asort() call in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 59
Warning: First argument to array_keys() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 70
Warning: First argument to array_slice() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 73
Warning: Wrong datatype in arsort() call in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 66
Warning: First argument to array_keys() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 70
Warning: First argument to array_slice() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 73
Warning: Wrong datatype in arsort() call in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 66
Warning: First argument to array_keys() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 70
Warning: First argument to array_slice() should be an array in D:\WWW\chaindlk.com\httpdocs\TEST\last-date.php on line 73
Other than that (if I don't uncomment the lowercase line and if I do remove those 4 print_r lines that look at the wrong directory), it seems to work...