strpos(), 左边开始,字符出现第一个位置,区分大小写;
stripos(),不区分大小写;
strrpos(), 左边开始,字符出现,最后一个位置,区分大小写;
strripos()不区分大小写;
$findme = 'a';
$mystring1 = 'axyz';
$mystring2 = 'BCaaaA';
$pos1 = strpos($mystring1, $findme);
$pos2 = strripos($mystring2, $findme);
if ($pos1 === false)
{
echo "The string '$findme' was not found in the string '$mystring1'
";
}
else{
echo "We found '$findme' in '$mystring1' at position $pos1
";
}
if ($pos2 !== false) {
echo "We found '$findme' in '$mystring2' at position $pos2";
}?>
We found 'a' in 'axyz' at position 0
We found 'a' in 'BCaaaA' at position 5