note 99713 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 Oct 2010 14:15:47 +0000 |
| Subject: | note 99713 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173471@lists.php.net to get a copy of this message | ||
Note Submitter: Nikolay Christov
----
Here is my simple but useful function for counting the number of occurrences of the needle into the
stack
<?php
function searchOccNum($needle, $stack){
$offset = 0;
$found = 0;
if(strpos($pm, $open_link) === false)
return 0;
else{
while(!(strpos($stack, $needle, $offset) === false)){
$found++;
$offset = strpos($pm, $open_link, $offset)+1;
}
return "found: ".$found." times";
}
}
?>