note 33445 deleted from function.eregi by didou
| From: | didou@php.net | Date: | Thu, 26 Jun 2003 11:45:38 +0000 |
| Subject: | note 33445 deleted from function.eregi by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-51030@lists.php.net to get a copy of this message | ||
Note Submitter: darf@gmx.net
----
if you want to count the number of files of a certain type, use this function (there might be a
faster/easier way, but I havn't found it yet):
function Get_File_Count($filetype,$directory)
{
$handle=opendir($directory);
while ($file = readdir($handle))
{
if (eregi($filetype, $file))
{
++$counter;
}
}
closedir($handle);
return $counter;
} //End function Get_File_Count;
echo(Get_File_Count(".jpg","."));