note 90267 modified in function.str-word-count by danbrown

From: Date: Mon, 13 Apr 2009 18:30:55 +0000
Subject: note 90267 modified in function.str-word-count by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153191@lists.php.net to get a copy of this message
Personally, I dont like using this function becuase the characters it omits are sometime nessesery for instance MS Word counts ">" or "<" alone as single word where this function doesnt. I like using this however, it counts EVERYTHING: <?php function num_words($string){ preg_match_all("/\S+/", $string, $matches); return count($matches[0]); } ?> --was-- Personally, I dont like using this function becuase the characters it omits are sometime nessesery for instance MS Word counts ">" or "<" alone as single word where this function doesnt. I like using this however, it counts EVERYTHING: function num_words($string){ preg_match_all("/\S+/", $string, $matches); return count($matches[0]); } http://php.net/manual/en/function.str-word-count.php

« previous php.notes (#153191) next »