iconv_strpos() - iconv函数(字符编码转换库)
iconv_strpos()
(PHP 5, PHP 7)
Finds position of first occurrence of a needle within a haystack
说明
iconv_strpos(string $haystack,string $needle[,int $offset= 0[,string $charset= ini_get("iconv.internal_encoding")]]): intFinds position of first occurrence of a$needlewithin a$haystack.
In contrast to strpos(), the return value of iconv_strpos() is the number of characters that appear before the needle, rather than the offset in bytes to the position where the needle has been found. The characters are counted on the basis of the specified character set$charset.
参数
$haystackThe entire string.
$needleThe searched substring.
$offsetThe optional$offsetparameter specifies the position from which the search should be performed. If the offset is negative, it is counted from the end of the string.
$charsetIf$charsetparameter is omitted,$stringare assumed to be encoded in iconv.internal_encoding.
If$haystackor$needleis not a string, it is converted to a string and applied as the ordinal value of a character.
返回值
Returns the numeric position of the first occurrence of$needlein$haystack.
If$needleis not found,iconv_strpos() will return FALSE
.
此函数可能返回布尔值FALSE
,但也可能返回等同于FALSE
的非布尔值。请阅读布尔类型章节以获取更多信息。应使用===运算符来测试此函数的返回值。
更新日志
版本 | 说明 |
---|---|
7.1.0 | Support for negative$offsets has been added. |
参见
strpos()
查找字符串首次出现的位置iconv_strrpos()
Finds the last occurrence of a needle within a haystackmb_strpos()
查找字符串在另一个字符串中首次出现的位置
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!