Please turn off read notifications when posting to a mailing list -
they're very annoying.
Adam Niedzwiedzki wrote:
(yeah ok.... But still doesn't explain why php ain't letting me (I'm
thinking BUG) :P)
Anyways this is how I'm handling the file...
if($fp = fopen($logfile, 'r')){
debug_log("$file has ".count(file($logfile))." lines to process");
while(!feof($fp)){
$line = fgets($fp);
You just made me relise I'm calling file() for the line count (That's a big
hit), any other way of doing it?
And YES I want a line count BEFORE I start looping through it...
Why?
Actually, why doesn't matter. If you really really need a line count
before you start processing it, then you'll have to run through the
while (feof) loop twice, once to count the lines and the second to
process them. If you were on a UNIX platform I would suggest calling out
to the wc utility - it's possible there's a version of that compiled for
windows somewhere and it would definitely be more efficient.
But I can't read line for line to do the gzcompress I have to load the whole
file up to compress it don't I?
gzcompress ($data, 9)
$data being the string (the whole file) of text I need to compress.
Two possible options... 1) write it out uncompressed and compress it
afterwards. Or 2) use the gz output buffer handler to do it (although
that may have the same effect on memory usage).
What is this script actually doing? There may be a better way[tm].
-Stut
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php