- strpos– find where the string first appears
- stripos– find where strings first appear (case insensitive)
- strrpos– calculates the last occurrence of the specified string in the target string
- Strripos– calculates the location of the last occurrence of the specified string in the target string (case insensitive)
Mixed Strpos (String $haystack, mixed $needle [, int $offset = 0])
return value
Success: Returns the position where the needle exists at the beginning of the haystack string (independent of offset)
Failed: Returns FALSE if needle is not found.
Note
- The string position is starting at 0, not starting from 1
- This function may return a Boolean value of false, but it may also return a non-Boolean value that is equivalent to False
You should use the = = = operator or!== to test the return value of this function
Stripos
Find where strings first appear (case insensitive)
Mixed Stripos (String $haystack, string $needle [, int $offset = 0])
Strrpos
Calculates the last occurrence of the specified string in the target string
Mixed Strrpos string $haystack Mixed $needle $offset = 0])
Note
- The string position is starting at 0, not starting from 1
- This function may return a Boolean value of false, but it may also return a non-Boolean value that is equivalent to False
You should use the = = = operator or!== to test the return value of this function
Strripos
Calculates the location of the last occurrence of the specified string in the target string (case insensitive)
Mixed Strripos (String $haystack, mixed $needle [, int $offset = 0])
PHP string function strpos stripos strrpos strripos