RE: [PHP] Using File to count number of lines
| From: | Jay Blanchard | Date: | Thu, 04 Aug 2005 12:32:51 +0000 |
| Subject: | RE: [PHP] Using File to count number of lines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-219995@lists.php.net to get a copy of this message | ||
[snip]
When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.
[/snip]
Sounds like that there are not any newline characters in the file. You
could do something like this...
$theFile = fopen("http://www.mysite.co.uk/mailing_list_database.list",
"r");
while(!feof($theFile)){
$theLine = fgets($theFile, 4096);
$theCount++;
}
fclose($theFile);
echo $theCount;