public static function strpos($haystack, $needle, $offset=0)
    {
        if(!defined('UTF8_NOMBSTRING') && function_exists('mb_strpos'))
            return mb_strpos($haystack,$needle,$offset,'utf-8');

        if(!$offset){
            $ar = self::explode($needle, $haystack);
            if ( count($ar) > 1 ) {
                return self::strlen($ar[0]);
            }
            return false;
        } else {
            if ( !is_int($offset) ) {
                trigger_error('Offset must be an integer',E_USER_WARNING);
                return false;
            }

            $str = self::substr($haystack, $offset);

            if ( false !== ($pos = self::strpos($str, $needle))){
                return $pos + $offset;
            }
            return false;
        }
    }
public static function strpos($haystack, $needle, $offset=0)
    {
        if(!defined('UTF8_NOMBSTRING') && function_exists('mb_strpos'))
            return mb_strpos($haystack,$needle,$offset,'utf-8');

        if(!$offset){
            $ar = self::explode($needle, $haystack);
            if ( count($ar) > 1 ) {
                return self::strlen($ar[0]);
            }
            return false;
        } else {
            if ( !is_int($offset) ) {
                trigger_error('Offset must be an integer',E_USER_WARNING);
                return false;
            }

            $str = self::substr($haystack, $offset);

            if ( false !== ($pos = self::strpos($str, $needle))){
                return $pos + $offset;
            }
            return false;
        }
    }
public static function strpos ( $ haystack , $ needle , $ offset = 0 ) { if ( ! defined ( 'UTF8_NOMBSTRING' ) && function_exists ( 'mb_strpos' ) ) return mb_strpos ( $ haystack , $ needle , $ offset , 'utf-8' ) ; if ( ! $ offset ) { $ ar = self :: explode ( $ needle , $ haystack ) ; if ( count ( $ ar ) > 1 ) { return self :: strlen ( $ ar [ 0 ] ) ; } return false ; } else { if ( ! is_int ( $ offset ) ) { trigger_error ( 'Offset must be an integer' , E_USER_WARNING ) ; return false ; } $ str = self :: substr ( $ haystack , $ offset ) ; if ( false !== ( $ pos = self :: strpos ( $ str , $ needle ) ) ) { return $ pos + $ offset ; } return false ; } }
This is an Unicode aware replacement for strpos

Uses mb_string extension if available

@author Harry Fuecks <hfuecks@gmail.com>
@see    strpos()
This is an Unicode aware replacement for strpos