[PHP] fopen and sort by date modified
hi there i was wondering how i could fopen a directory and then sort the files by date modified is there a way ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen and sort by date modified
Op woensdag 14 augustus 2002 13:04, schreef electroteque: hi there i was wondering how i could fopen a directory and then sort the files by date modified is there a way ? ?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo Directory handle: $handle\n; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v).\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen and sort by date modified
sweet , damn filemtime this was hiding from me :) -Original Message- From: Bas Jobsen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 8:48 PM To: electroteque; [EMAIL PROTECTED] Subject: Re: [PHP] fopen and sort by date modified Op woensdag 14 augustus 2002 13:04, schreef electroteque: hi there i was wondering how i could fopen a directory and then sort the files by date modified is there a way ? ?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo Directory handle: $handle\n; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v).\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen and sort by date modified
unfortunately this isnt sorting by date modified ? -Original Message- From: Bas Jobsen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 8:48 PM To: electroteque; [EMAIL PROTECTED] Subject: Re: [PHP] fopen and sort by date modified Op woensdag 14 augustus 2002 13:04, schreef electroteque: hi there i was wondering how i could fopen a directory and then sort the files by date modified is there a way ? ?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo Directory handle: $handle\n; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v).\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php