getFilename()[0] === '.') { # skip hidden files and directories return FALSE; } if ($current->isLink()) { # ignore symlinks, original contents only return FALSE; } return $current->isDir() || preg_match('/\.html$/', $current->getFilename()); } ); # order alphabetically by link $dir = iterator_to_array(new RecursiveIteratorIterator($search)); array_walk($dir, function (&$row, $name) { # prepare values for sorting (directory index first) $row = preg_replace('{/index\.html$}', '', $name); }); asort($dir); # list article details print '\n";