On Sat, 30 Nov 2002, Randum Ian wrote:

> Ministry is the name of the club.
> Full is the type of the content.
> 6122002 is the date - It is in the form ddmmyyyy so the example here is
> 6th December 2002.
> Is there a simple way I can just grab the date and sort it by order?
> Should I change the format of the date to make it easier or something?

It'd be easier to sort if you changed your date format a bit ... what you
have is rather difficult to work with, unless you take the string apart.
(i.e. - How is '7102002' not greater than '6122002'?)
For simplicity & ease, I work with date strings formatted as "YYYYMMDD".
If your files were named "something-full-YYYYMMDD", you could get a sorted
array of your files easily.

$interestingFiles = array();
$dir = opendir( "/path/to/directory" ) or die( "Could not open dir" );
while( $dirEntry = readdir( $dir ) ){
  if( ereg( "full-([0-9]{8})", $dirEntry, $MATCH ) ){
   $interestingFiles[$MATCH[1]] = $dirEntry;
ksort( $interestingFiles );


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to