Re: counting lines in a file?

From: Date: Tue, 03 Oct 2000 16:48:39 +0000
Subject: Re: counting lines in a file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18448@lists.php.net to get a copy of this message
is your records are variable length? if not, you could use the following logic sizeof(filename)/recordlength "Boget, Chris" wrote: > > $f = fopen($filename); > > $x=0; > > while(!feof($f)){ > > $tmp = fgets($f,10000000); > > $x++; > > } > > now $x contain the number of lines > > Wait a second... > Your lines regularly have 10,000,000 characters in them? > The only thing the above will do is tell you how many > tens of million characters you have in the file. > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#18448) next »