Originally posted by xwin
Tried changing them all. No difference.
Well, how about this: since $memmatch is going to be the same file ('members.txt') every time, reading it for every line of data/forum{$f}/{$id}.txt is definitely the Wrong Thing to do, anyway.
$replyfile = file ("data/forum{$f}/{$id}.txt");
$memmatch = file('members.txt');
Might as well break them all out into parts we're wanting now:
foreach($replyfile as $key=>$line)
{ list($rid, $reply, $memidr) = explode('|', $line);
//We're only interested in $memidr and $reply
$replies['memidr'][]=$memidr;
$replies['reply'][]=$reply;
}
foreach($memmatch as $key=>$line)
{ list($mid, $name, $md5, $postcount) = explode("|", $line);
$members['mid'][]=$mid;
$members['name'][]=$name;
$members['postcount'][]=$postcount;
}
Then you can look through the $replies and $members arrays for the information, instead of repeatedly falling back on the file system.
I observe also that you're starting a <table> in your inner loop - who knows how many <tables> will get written - but only one </table> will get written, because that lies outside both loops.
...and consider using a database instead.