note 26471 modified in function.str-word-count by aidan
| From: | aidan@php.net | Date: | Sat, 26 Jun 2004 06:19:12 +0000 |
| Subject: | note 26471 modified in function.str-word-count by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71725@lists.php.net to get a copy of this message | ||
i tried to write a wordcounter and ended up with this:
<?php
//strip html-codes or entities
$text = strip_tags(strtr($text, array_flip(get_html_translation_table(HTML_ENTITIES))));
//count the words
$wordcount = preg_match_all("#(\w+)#", $text, $match_dummy );
?>
--was--
i tried to write a wordcounter and ended up with this:
//strip html-codes or entities
$text = strip_tags(strtr($text, array_flip(get_html_translation_table(HTML_ENTITIES))));
//count the words
$wordcount = preg_match_all("#(\w+)#", $text, $match_dummy );
http://php.net/manual/en/function.str-word-count.php