$heading[0]"; } function match($regex) { global $fid; } function total() { global $i; return ++$i; } function errors() { global $i ; global $line; global $lines; $bits = explode(" ",$line); $lines = array($i+1=>$bits[7].$bits[5]); } $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(); $i = 0; $num = 0; $fid = fopen('tma/'.$file, 'r'); $regex = '/(^.+articles.+$)/i'; $lines = array(); while (!feof($fid)) { $line = fgets($fid, 1024); errors(); total(); if (preg_match($regex, $line)) { counter(); } } print_r($lines); echo $i-1,'
'; echo $num,'
'; } fclose($fid); closedir($dir); ?>