I’m looking for a function that counts the number of times a string occurs within a file, I tried using $count = preg_match_all("/String/", $file, $matches); but it 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 any way to assign a file to a string (I assume the latter would be a lot slower)?
I’m looking for a function that counts the number of times a string occurs
Share
yes:
http://php.net/manual/en/function.file-get-contents.php
so for you it would be
I’m guessing you have used
fopeninstead by mistake?