Russell P Jones wrote:
Im trying to count the number of times a word occurs in a string - is the
only way to do this preg_match_all?

Russ Jones


No, there are hundreds of other ways; but, preg_match_all() is probably the easiest.

$number= preg_match_all("%$word%sm", $string, $matches);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to