word counter
Posted: Wed Feb 09, 2005 9:08 pm
Is there a function that would count number of words in a sentence ? If not what is the easiest way of doing that. Any help is welcome 
Thank you.
Greg
Thank you.
Greg
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
//count words
$words_to_count = strip_tags($body);
$pattern = "/ї^(\w|\d|''|"|\.|\!|\?|;|,|\\|\/|\-\-|:|\&|@)]+/";
$words_to_count = preg_replace ($pattern, " ", $words_to_count);
$words_to_count = trim($words_to_count);
$total_words = count(explode(" ",$words_to_count));
?>Not really. I read the forum topics via RSS feed, and I did reduce the refresh rate to 15min because I should do other things at the moment than serving the web and answering stupid questions...need to get faster fingers
booooooooooooooodjot wrote:-
...and answering stupid questions...
-
Yes booo.boooooooooooooooooooooooo