List directories by date using PHP


I struggled for an elegant way to list directories and files by date with PHP.  Here is the fruit of much Google-Fu.  This will list directories and files from newest to oldest.

Warning: count(): Parameter must be an array or an object that implements Countable in /home/public/blog/wp-includes/class-wp-comment-query.php on line 399

There is 1 comment in this article:

  1. 7/03/2012Joshua Paine say:

    If >1 file has the same mtime, only the last (original directory order) will be displayed.

Write a comment: