Forum Moderators: coopster
You could use file_get_contents() [php.net] to read the file into a string and then use str_word_count() [php.net].
You'd probably want to call it thusly:
system("wc -w " . $filename);
wc can also count bytes and lines, if you call it with -c or -l, respectively.
I often use it to quickly analyze a log file ala
grep "oogle" mylog ¦ wc -l
to see how many times the string "oogle" appeared in the file "mylog".