note 23884 added to function.count-chars
| From: | carl dot corliss at postnuke dot com | Date: | Tue, 30 Jul 2002 23:15:50 +0000 |
| Subject: | note 23884 added to function.count-chars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34022@lists.php.net to get a copy of this message | ||
I might even suggest adding this line:
$var = eregi_replace(" +", " ", $string);
to make any instance of multiple spaces into one space... that should help somewhat...
function count_words($string) {
// below line added to make contiguous spaces count as one space
$string = eregi_replace(" +", " ", $string);
$result = count_chars($string, 0);
return(round($result[32], -1));
}
Note: I haven't tested this but, I believe it should work... :)
--
http://www.php.net/manual/en/function.count-chars.php
http://master.php.net/manage/user-notes.php?action=edit+23884
http://master.php.net/manage/user-notes.php?action=delete+23884
http://master.php.net/manage/user-notes.php?action=reject+23884