Hi, I have a quick question.
As the title says, I'd like to find a way to count the number of lines that contain a specified string in a file, in PHP.
I know I could simply open the file and loop through all the lines and see if anything matches, but that seems kind of cumbersome. Is there a better way?
To further illustrate what I want to do, here's how it could look with awk:
awk '/KEYWORD/ {i++} END { print i }' FILE
Thanks!