RE: [PHP] one pattern, one string, multiple results
| From: | Maxim Maletsky \(PHPBeginner.com\) | Date: | Wed, 26 Sep 2001 07:40:56 +0000 |
| Subject: | RE: [PHP] one pattern, one string, multiple results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68824@lists.php.net to get a copy of this message | ||
Hi Richard.
Subsrt_count() is what you are looking for:
int substr_count (string haystrack, string needle)
php.net/substr_count
P.S: Helen Fielding's Bridget Jones Diary is a nice novel, hun?
Maxim Maletsky
PHPBeginner.com
-----Original Message-----
From: Richard Baskett [mailto:rick@baskettcase.com]
Sent: mercoledi 26 settembre 2001 9.01
To: PHP General
Subject: [PHP] one pattern, one string, multiple results
I just can not seem to figure this out.
If i have a pattern 'arc' and I want to search the string:
"an arc is an archer, but what about marc and darcy?"
How can I find out how many occurances of arc is within that string? I
know I can do an explode and then compare it, but when you have huge
amounts of text... is this the best way? Or is there something better?
Any help would be great I have been struggling with this for awhile,
since I really do not want to explode, pun intended :)
Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net To
contact the list administrators, e-mail: php-list-admin@lists.php.net