public static function textLength($strText, $strEncoding = '')
    {

        if (is_null(self::$blnMbstring)) {
            self::$blnMbstring = extension_loaded('mbstring');
        }

        if (!self::$blnMbstring) {
            $intTextLength = strlen($strText);
        } else {
            if ($strEncoding == '') {
                $intTextLength = mb_strlen($strText);
            } else {
                $intTextLength = mb_strlen($strText, $strEncoding);
            }
        }

        return $intTextLength;
    }
public static function textLength($strText, $strEncoding = '')
    {

        if (is_null(self::$blnMbstring)) {
            self::$blnMbstring = extension_loaded('mbstring');
        }

        if (!self::$blnMbstring) {
            $intTextLength = strlen($strText);
        } else {
            if ($strEncoding == '') {
                $intTextLength = mb_strlen($strText);
            } else {
                $intTextLength = mb_strlen($strText, $strEncoding);
            }
        }

        return $intTextLength;
    }
public static function textLength ( $ strText , $ strEncoding = '' ) { if ( is_null ( self :: $ blnMbstring ) ) { self :: $ blnMbstring = extension_loaded ( 'mbstring' ) ; } if ( ! self :: $ blnMbstring ) { $ intTextLength = strlen ( $ strText ) ; } else { if ( $ strEncoding == '' ) { $ intTextLength = mb_strlen ( $ strText ) ; } else { $ intTextLength = mb_strlen ( $ strText , $ strEncoding ) ; } } return $ intTextLength ; }
Gives string length. Tries mb_strlen and if that fails uses regular strlen.
@param   string  $strText      Text to be measured
@param   string  $strEncoding  Encoding of text
@return  int
Gives string length . Tries mb_strlen and if that fails uses regular strlen .