function counter() {
static $num = 0;
return ++$num;
}
$subdir = 'tma';
$dir = opendir($subdir);
if (!$dir) {
die('FAILED to open directory. Are you sure it exists?');
}
while (false!==($file=readdir($dir))) {
if (!is_file($subdir.'/'.$file)) {
continue;
}
$heading = explode('.',$file);
echo "$heading[0]
";
$fid = fopen('tma/'.$file,'r');
while (!feof($fid)) {
$line = fgets($fid,1024);
$regexa='/(^.+articles.+$)/i';
if(preg_match($regexa,$line)) {
$art = counter();
}
}
echo $art;
fclose($fid);
}
closedir($dir);
?>