strripos() : Position of last occurence of the case insensitive search string
Main_string : The string inside of which the search_string will be searched. search_strig : This is searched within the Main_string. offset : (optional, integer ) Starting point of search but position count is returned from beginning or ending of the string. Negative integer is allowed to search from end of the string in PHP version 7.0.1
![]() Using OffsetNote that first position is 0 ( zero ) .Position of last occurrence is returned starting from beginning of the string . This counting of position is irrespective of given offset. If position is given negative then search will start by leaving that many characters from end of the string in backward direction.
Checking return valueWe may get Boolean value as false and it may also return non-Boolean value. We need to evaluate the return value using === operator or !== to get the correct output. Check this code below and the outputs
Using the same code we will search for string W
The search string is already present at position 0 . Above code need to change like this to get correct output.
Use === or !== to test the return value
case-insensitivestrrpos() is case sensitive
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
![]() | ||
| ||