Linking to the latest fileNAME

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Aerostato
Forum Newbie
Posts: 1
Joined: Fri Jan 16, 2009 9:52 pm

Linking to the latest fileNAME

Post by Aerostato »

I have files with names increasing in number, such as

filename0001.php
filename0002.php
filename0003.php
filename0004.php
filename0005.php
etc.

From the index.php page I would like to have a link that points to the filename with latest (greater) number in its name, so that first it points to filename0005.php but as soon as the filename0006.php is added, the link points to the new file instead.

How can this be achieved?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: Linking to the latest fileNAME

Post by Burrito »

Code: Select all

 
asort($filenamearray);
$lastfile = array_pop($filenamearray);
 
Post Reply