Re: Using File to count number of lines

From: Date: Thu, 04 Aug 2005 12:17:49 +0000
Subject: Re: Using File to count number of lines
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-219992@lists.php.net to get a copy of this message
you sure each is on its own line (\n) ? if you're only getting a value of 1 it is likely putting everything on a single array key.. Tom Chubb wrote:
I'm having a problem with the following code: <?php $file = "http://www.mysite.co.uk/mailing_list_database.list"; $lines = count(file($file)); echo "$lines "; ?> I'm trying to show the number of subscribers to my visitors from a text file, but it returns a value of 1 when it should be 5000. I think it's to do with recognising the line break but I don't know how to make it work!?! (I've looked on php.net for the file, fopen & count functions and can't find anything, although fopen mentions using the -t mode. Any ideas? Thanks, Tom
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

« previous php.general (#219992) next »