note 51500 added to function.glob
| From: | cjcommunications at gmail dot com | Date: | Fri, 01 Apr 2005 13:02:15 +0000 |
| Subject: | note 51500 added to function.glob | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87317@lists.php.net to get a copy of this message | ||
Here is a way I used glob() to browse a directory, pull the file name out, resort according to the
most recent date and format it using date(). I called the function inside a <select> and had
it go directly to the PDF file:
function browsepdf(){
$pdffile=glob("printable/*.pdf");
rsort($pdffile);
foreach($pdffile as $filename){
$filename=ltrim($filename, "printable/");
$filename=rtrim($filename, ".pdf");
$file=$filename;
$datetime=strtotime($filename);
$newdate=strtotime("+3 days",$datetime);
$filenamedate=date("F d", $datetime);
$filenamedate.=" - ".date("F d, Y", $newdate);
echo "<option value='$file'>$filenamedate</option>";
}
}
----
Manual Page -- http://www.php.net/manual/en/function.glob.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51500
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51500&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51500&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51500&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51500&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51500&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51500&report=yes
Search -- http://master.php.net/manage/user-notes.php