Counting occurances
| From: | Wizaerd | Date: | Mon, 14 Aug 2000 00:45:58 +0000 |
| Subject: | Counting occurances | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11540@lists.php.net to get a copy of this message | ||
Is there a PHP function I'm missing somewhere that'll count the number of
occurances of a substring within a string?
Something such as:
$cStr = "There is a cat in the house. It is a mean cat. We should shoot
that cat.";
$nCount = str_count( "cat", $cStr ); // would return 3
$nCount = str_count( "o", $cStr ); // would return 4
Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics, ColdFusion
http://www.wizaerd.com
=================================