note 40155 deleted from function.readdir by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 27 Jun 2004 13:12:15 +0000 |
| Subject: | note 40155 deleted from function.readdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71880@lists.php.net to get a copy of this message | ||
Note Submitter: blazalek(at)student_legnica_edu_pl
----
Fuction bellow counts number of files in dir
for linux:
function countfiles($path)
{
$i=0;
$dir = opendir($path);
while ($file = readdir($dir)){
{ $i++; }
}//end while
closedir($dir);
$i=$i-3;
return $i;
}
for windows:
function countfiles($path)
{
$i=0;
$dir = opendir($path);
while ($file = readdir($dir)){
{ $i++; }
}//end while
closedir($dir);
$i=$i-4; // difference
return $i;
}
It is changesd version of the function comennted here by
mario at comicide dot com 29-Dec-2002 10:58
http://www.php.net/strstr