Strpos---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Find out where the string first appears
Syntax: int strpos (String haystack, string needle [, int offset])
Description:
Returns the position of the first occurrence of the parameter needle in the string haystack, expressed numerically. Unlike Strrpos (), this function can take arguments needle all strings and use all strings.
Returns false if the parameter needle is not found.
Note: It is easy to return the value "character found at position 0" and "character not found" to make a mistake, and the following is how to perceive the difference:
In PHP 4.0b3 and newer:
$pos = Strpos ($mystring, "B");
if ($pos = = False) {//Note:three equal signs
Not found ...
}
In versions older than 4.0B3:
$pos = Strpos ($mystring, "B");
if (is_string ($pos) &&! $pos) {
Not found ...
}
If the parameter needle is not a string, it is converted to an integer and used in accordance with the ordinal value of the character.
Parameter offset allows you to specify the start of the search from that character in the haystack, and the return position is still the starting point relative to the haystack.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.