php What is strpos?
php strpos is a PHP built-in function. The strpos() function finds the first occurrence of a string in another string.
Note: The strpos() function is case-sensitive.
Note: This function is binary safe.
Recommended: "PHP Tutorial"
Related functions:
stripos() - Find another character in a string The position of the first occurrence of a string in a string (case-insensitive)
strripos() - Finds the position of the last occurrence of a string in another string (case-insensitive)
strrpos() - Finds the last occurrence of a string within another string (case sensitive)
Syntax
strpos(string,find,start)
Parameters
string Required. Specifies the string to search for.
find Required. Specifies the string to search for.
start Optional. Specifies where to start the search.
Return value:
Returns the position of the first occurrence of a string in another string, or returns FALSE if the string is not found.
Note: The string position starts from 0, not from 1.
Example
Find the first occurrence of "php" in the string:
echo strpos("You love php, I love php too!","php");
?>
The above is the detailed content of what is php strpos. For more information, please follow other related articles on the PHP Chinese website!