strripos() Searches From The End
<?php
namespace A {
use B\C{
const BAR AS FOO
};
}
?>
Today, I got bitten by someone (sic) who wrote as in uppercase AS and it made me use PHP strripos() for the first time ever.
Did you know there are 4 strpos() you can rely on?
strpos(), stripos() is case-insensitive, strrpos() search from the end, strripos searches from the end and is case insenstive.
All of them are affected by the strpos() syndrom.
Also, don’t use AS with constants, just because const should be uppercase.
See Also
- strpos (PHP manual)
- stripos (PHP manual)
- strrpos (PHP manual)
- strripos (PHP manual)
- Only related code in static analysis context [Try me]
PHP Features
Last updated: 11 October 2026