If it happens on Linux and all the files in one folder, you can do this:
$path = 'dirname/*'; // all files in dirname $result = shell_exec('wc-l' . $path);
in $result you will get a string of the form
10 filename1.txt 17 filename2.txt 27 total
Only have to parse this string in a convenient way.
Another way: count(file($filename))
First you need to get all the paths to the files.
Often it is convenient to do with php.net/manual/ru/function.glob.php
Iterate through the array of paths and run on each
storing the result into an array, simultaneously summing up in a separate variable.