Function stripos in PHP4


According to the document of PHP official website, http://php.net/stripos

stripos

(PHP 5)

stripos — Find the position of the first occurrence of a case-insensitive substring in a string

So, it’s only for PHP5+. In PHP4, we use this function below:

if (!function_exists('stripos')) {
    function stripos($haystack, $needle, $offset = 0)
    {
        return strpos(strtolower($haystack), strtolower($needle), $offset);
    }
}

Leave a Reply