Count the number of lines in a text file
Here is a 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.
Example
<?php
$fileName = “filename.txt”;
$NoOflines = count(file($fileName));
echo “There are $NoOflines lines in $fileName”;
?>
