Re: Matching Number of Times a Word Occurs...

From: Date: Wed, 20 Apr 2005 00:25:42 +0000
Subject: Re: Matching Number of Times a Word Occurs...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213439@lists.php.net to get a copy of this message
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);

« previous php.general (#213439) next »