Find all occurences of a string - PHP Views : 302
Tagged in : PHP
0 1
Send mail
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;
}

}
By Rekha, On - 2010-03-12



    Login to add Comments .