Justin French wrote: > It depends on what you define as a word, but let's take the simple > approach of stripping HTML et al, and exploding the string on the > spaces, then counting the array of words: > > <? > $str = "This is my <b> text </b> that I want to count"; > $words = explode(' ', strip_tags($str)); > $count = count($words);
I believe substr_count() is faster than that method. http://www.php.net/manual/en/function.substr-count.php Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php