PHP stripos() Function
Example
Find the first occurrence of "php" in the string:
<?php echo stripos("You love php, I love php too!","PHP"); ?>
Definition and Usage
The stripos() function finds the first occurrence of a string in another string (case-insensitive).
Note:The stripos() function is case-insensitive.
Note:This function is binary safe.
Related Functions:
- strpos() - Find the first occurrence of a string in another string (case-sensitive)
- strripos() - Find the last occurrence of a string in another string (case-insensitive)
- strrpos() - Find the last occurrence of a string in another string (case-sensitive)
Syntax
stripos(string,find,start)
Parameters | Description |
---|---|
string | Required. Specifies the string to be searched. |
find | Required. Specifies the character to be searched for. |
start | Optional. Specifies the position to start the search. |
Technical Details
Return Value: |
Returns the position of the first occurrence of a string within another string, or FALSE if the string is not found. Note:String positions start from 0, not from 1. |
PHP Version: | 5+ |