Read dir and display ONLY 10 newest files as a link



I never did it before, but you might start by looking into:

Maybe use scandir() to get an array of filenames in a directory and then you could probably cycle through the array of files and use a function like filectime() to see what the date on the file is.

There may be an easier way, but at least that is a good place to start looking. check and put in dir and file to get a list of functions for each.
scandir() is a PHP5-only function. What you'll have to do is use readdir() to read the filenames into an array, and as you do so, check to make sure they are .php files, and check their last-modified times using filemtime() to get the ten most recent.

The fastest way to use this would be to build an associative array where the filenames are the keys and their last-modified times are their values. Then once you have them all in an array, you can just sort by last-modified time (you'll want to convert to UNIXTIME using strtotime() for this to work).
Go back and read my post. If you do what it says, you'll be fine. You need to read the filenames and last-modified dates into an array before outputting the HTML.
while using while,
put a counter like $i, and exit the while loop if the counter is greater than a required value