Count words in file using php

by satheeshkumar 2012-08-16 22:42:17

Count the Number of words in file using php code,



$filename = "file name";
$string = file_get_contents($filename);
$numWords = str_word_count($string);
echo "This file have ". $numWords . " words";
?>
901
like
0
dislike
0
mail
flag

You must LOGIN to add comments