|
Posted by Al on 04/20/05 03:25
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);
Navigation:
[Reply to this message]
|