Find all occurences of a string

by Rekha 2010-03-12 11:34:37

Function to find all occurences of a string

function find_occurences($string, $find) {
if (strpos(strtolower($string), strtolower($find)) !== FALSE) {
$pos = -1;
for ($i=0; $i $pos = strpos(strtolower($string), strtolower($find), $pos+1);
$positionarray[] = $pos;
}

return $positionarray;
}
else {
return FALSE;
}

}

Tagged in:

1060
like
0
dislike
0
mail
flag

You must LOGIN to add comments