I have to list directories by using scandir() function but result array should be sorted according to date and time of directory created.
Regards Deepak
you could try backticks
$listOfFiles = `ls -ltr`;
and then use explode to get the into an array format
With scandir() you cannot.
Check this
Problem can be solved by using filemtime($dirPath)
function.
code sample:
if (file_exists($dirPath)) {
echo "last modified: " . date ("F d Y H:i:s.", filemtime($dirPath));
}
Get results you need into an array and sort it... I'm not aware of a scandir option that can do this directly.