I want get all the foldernames inside the directory and sort by the created date. now I am using the following code for getting all the fodernames inside the directory.
$path = 'userfiles';
$dirs = array();
// directory handle
$dir = dir($path);
while (false !== ($entry = $dir->read())) {
if ($entry != '.' && $entry != '..') {
if (is_dir($path . '/' .$entry)) {
$dirs[] = $entry;
}
}
}
It displays all the foldername but not by created date.
Userfiles
-->My Folder
-->My Folder 2