On Sep 12, 3:46 pm, quickshif...@gmail.com ("Nathan Nobbe") wrote:
>
> if you want a cross-platform solution (not that i use windows
)
> or you dont want to use exec() or related functions look to the stream
> functions. they support buffered reading, so theorectically a script could
> read portions of a file and count lines as it read through the portions.
>
> -nathan
Right -- something like this:
$numLines = 0;
$handle = fopen('/path/to/myfile.txt', 'r');
while(!feof($handle)) {
fgets($handle);
++$numLines;
}
fclose($handle);