I am looking for a function that counts the number of lines in a file, I tried to use $count = preg_match_all("/String/", $file, $matches); , but returns Warning: preg_match_all() expects parameter 2 to be string, resource given . Is there any function that allows me to do this with a file instead of a string, or is there a way to assign a file to a string (I assume the latter will be much slower)?
source share