Im trying to count the number of words in a document using PHP.
I already have a function that returns the number of words in a string:
function wordCount($string){
$words = "";
$string = eregi_replace(" +", " ", $string);
$array = explode(" ", $string);
for($i=0;$i < count($array);$i++) {
if (eregi("[0-9A-Za-zÀ-ÖØ-öø-ÿ]", $array[$i])) $words[$i] = $array[$i];
}
return $words;
}
So I thought I could try to read the file and put the content in a string but its not working.
BTW, the documents Im trying to do this with, are Word, Excel and PDF…
Any ideas on how to do this???
Thanks.