I guess you could do something like : <?php
function countLines($filename) { if(file_exists($filename)) { $linecount=0; $fs = file($filename); while (list ($linenum, $linec) = each($fs)) { $linecount++; } return $linecount; } } $local_file = "/path/to/testfile.txt"; $lines = countLines($local_file); ?> That would count all the lines in the file. /Morten -----Original Message----- From: Markus [mailto:[EMAIL PROTECTED] Sent: 17. oktober 2003 11:25 To: [EMAIL PROTECTED] Subject: [PHP] Count lines or chars Hi PHP-gurus :-) I'd like to count the lines within a file and store the result within a variable. Every line begins with the char %. Would it be easier to count these chars and how could I do that? Thanks for your help. markus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php