I'm not certain if this answers your question or not...
after laoding the array of the file:
<?PHP
exec("cat $filename", $file_array);
$number_array = count($file_array);
?>
or you can also count the "\n"'s in the string to get the number of lines...