Count the number of lines in a text file
Extremely simple PHP sample to count and return the number of lines in a text file. The output can be customised to suit your own requirements.
$file = "somefile.txt";
$lines = count(file($file));
echo "There are $lines lines in $file";
Get the code
Download the file to your computer: Click here to get the file