note 38375 modified in function.strpos by aidan
| From: | aidan@php.net | Date: | Thu, 10 Jun 2004 06:58:11 +0000 |
| Subject: | note 38375 modified in function.strpos by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70813@lists.php.net to get a copy of this message | ||
A simple function to find the number of occurances in a string within a string
<?php
function StringCount($searchstring, $findstring)
{
return (strpos($searchstring, $findstring) === false ? 0 : count(split($findstring,
$searchstring)) - 1);
}
?>
--was--
A simple function to find the number of occurances in a string within a string
function StringCount($searchstring, $findstring)
{
return (strpos($searchstring, $findstring) === false ? 0 : count(split($findstring,
$searchstring)) - 1);
}
http://www.php.net/manual/en/function.strpos.php