PHP stripos()Functions
Examples
Find the first occurrence of "php" in a string:
<?php
echo stripos("I love php, I love php too!","PHP");
?>
echo stripos("I love php, I love php too!","PHP");
?>
Run Example »
Definition and Usage
The stripos() function finds the first occurrence of a string within another string (case-insensitive).
Note:The stripos() function is case-insensitive.
Note:This function is binary-safe.
Related functions:
- strripos()- Finds the last occurrence of a string within another string (case-insensitive)
- strpos()- Finds the first occurrence of a string within another string (case-sensitive)
- strrpos()- Finds the last occurrence of a string within 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 search 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 at 0, not at 1. |
|---|---|
| PHP Version: | 5+ |
PHP String Reference Manual Other Extensions