Backend Development 3 min read

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.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP strripos() Function: Case‑Insensitive Search for the Last Occurrence

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)
backendphptutorialstring-functionscase-insensitive
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.