substr_count()


php program
function searchtext ($haystack, $needle){
if (substr_count ($haystack, $needle) == 0){
echo “No instances were found of this search query”;
} else {
$startpos = 0;
$lookagain = true;
while ($lookagain){
if ($pos = strpos ($haystack, $needle, $startpos)){
echo “The search term \”$needle\” was found at position: $pos “; ….

Detail