PHP strripos() Function: Case‑Insensitive Search for the Last Occurrence
This article explains PHP’s strripos() function, which performs a case‑insensitive search for the last occurrence of a substring, details its parameters and return values, and provides a complete example with code and expected output.
The PHP strripos() function searches for the last occurrence of a needle string within a haystack string without regard to case, returning the zero‑based position or FALSE if the needle is not found.
Parameters
haystack – the string to be searched.
needle – the string or character to locate.
offset (optional) – an integer offset; a negative value starts the search from the beginning up to that offset.
Return value
Integer position of the needle in the haystack (starting at 0) or FALSE when the needle does not occur.
Example
Output
//Congratulations!
//We found the last (aB) in (ababcd) at position (2)Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.