Hi all.
I need to know how can i count files using the first 3 beginning letter of file name:
this is the code i'm using, it list and sort the files on the directory bu I need to count it:
for ($count=0;$count<count($filelist);$count++)
{
$filename=$filelist[$count];
if (!is_dir($filename))
$nombase=(basename($filename));
printf (substr("$nombase", 0, 2));
}
All files start with two number or letter example:
Files Total
10 35
13 55
15 25
16 29
Thank in advance
Count Files on Directory?
Moderator: General Moderators
Re: Count Files on Directory?
Here's something to start you off:
Since that's not much I'll give you a bit more:
Code: Select all
$count = array();Code: Select all
if (!isset($count[$prefix])) $count[$prefix] = 1; else $count[$prefix]++;Re: Count Files on Directory?
Thanks a lot 