PHP File Tips - Part 9: Do you want to count number of line of a particular file? You can use little trick. Read the file into array. Than, count number of element of the array. Like this:
<?php
$f = "test.txt";
// read into array
$arr = file($f);
// count lines
echo "This file have ". sizeof($arr) . " line(s)";
?>