php stripos() function is used to find the first occurrence of a string in another string (not case-sensitive). The syntax is stripos(string,find,start). If the string is not found, it will be returned. FALSE.
How to use the php stripos() function?
The stripos() function finds the first occurrence of a string in another string (case-insensitive).
Syntax:
stripos(string,find,start)
Parameters:
● string: required. Specifies the string to search for.
● find: required. Specifies the characters to search for.
● start: optional. Specifies the location from which 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: stripos() function is case-insensitive; this function is binary safe. String positions start at 0, not 1.
Let’s take a look at how to use the php stripos() function through an example.
Example 1:
<?php echo stripos("You love php, I love php too!","PHP") ?>
Output:
9
Example 2:
<?php echo stripos("PHP is a good development language!","php"); ?>
Output:
0
The above is the detailed content of How to use php stripos function?. For more information, please follow other related articles on the PHP Chinese website!