字符串查找字符(4个函数)
stripos()
stripos() 用来查找字符串中某部分字符串首次出现的位置(不区分大小写)。
int stripos ( string $haystack , string $needle [, int $offset = 0 ] )
strpos()
strpos() 用来查找字符串首次出现的位置。
mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
strpos() 和 strrpos()、strripos() 不一样,strpos 的偏移量不能是负数。
strripos()
strripos() 用来计算指定字符串在目标字符串中最后一次出现的位置(不区分大小写)。
int strripos ( string $haystack , string $needle [, int $offset = 0 ] )
负数偏移量将使得查找从字符串的起始位置开始,到 offset 位置为止。
strrpos()
strrpos() 用来计算指定字符串在目标字符串中最后一次出现的位置。
int strrpos ( string $haystack , string $needle [, int $offset = 0 ] )
如果是负数的偏移量,将会导致查找在字符串结尾处开始的计数位置处结束。