Re: counting words.
| From: | Ron Rudman | Date: | Sun, 06 Apr 2003 22:44:58 +0000 |
| Subject: | Re: counting words. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142618@lists.php.net to get a copy of this message | ||
It's str_word_count();
"Haseeb Iqbal" <webcodder@hotmail.com> wrote in message
news:DAV70KAk5yT1eWb20N90000517e@hotmail.com...
> i think there is a built in php funtion for counting words.i think its
> str_count_words or count_words you better take a look
> Haseev
>
> ----- Original Message -----
> From: "Sebastian" <sebastian@dslr.net>
> To: "php list" <php-general@lists.php.net>
> Sent: Sunday, April 06, 2003 5:46 PM
> Subject: [PHP] counting words.
>
>
> > hello,
> >
> > I am trying to count the words from text that is fetched from mysql, It
> > works, but it's a little inaccurate.. It's about 5 - 10 words off, My
> guess
> > it's probably counting some HTML or something. Is there a more accurate
> way
> > of counting words?
> >
> > $row[12] = strip_tags(strtr($row[12],
> > array_flip(get_html_translation_table(HTML_ENTITIES))));
> > $wordcount = preg_match_all("#(\w+)#", $row[12], $match_dummy);
> >
> > if($wordcount == "0") {
> > $count ="";
> > } else {
> > $count = preg_match_all("#(\w+)#", $row[12], $match_dummy);
> > }
> >
> >
> > cheers,
> > - Sebastian
> >
> >
> >