Skip to content

Instantly share code, notes, and snippets.

@lukegb
Created July 18, 2010 20:32
Show Gist options
  • Save lukegb/480686 to your computer and use it in GitHub Desktop.
Save lukegb/480686 to your computer and use it in GitHub Desktop.
<?php
$dir = 'news';
$nstuffa = scandir($dir);
$nstuff = array();
foreach ($nstuffa as $nitem) {
if ($nitem == '.' || $nitem == '..') continue;
$nstuff[$nitem] = filectime($dir.'/'.$nitem);
}
arsort($nstuff, SORT_NUMERIC);
$ncount = 0;
foreach ($nstuff as $nitem => $ntime) {
$thelist .= '<li><a href="/'.$dir.'/'.$nitem.'">'.$nitem.'</li></a>';
if (++$ncount >= 5)
break;
}
echo $thelist;
@glittershark
Copy link

glittershark commented Jul 13, 2020

this is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment