Esempio n. 1
0
 /**
  * Returns the character length of a string.
  *
  * @param string $str A multibyte or singlebyte string.
  *
  * @return integer  The string length.
  */
 function _strlen($str)
 {
     static $mbstring;
     // Strip ANSI color codes if requested.
     if ($this->_ansiColor) {
         $str = $this->_ansiColor->strip($str);
     }
     // Cache expensive function_exists() calls.
     if (!isset($mbstring)) {
         $mbstring = function_exists('mb_strwidth');
     }
     if ($mbstring) {
         return mb_strwidth($str, $this->_charset);
     }
     return strlen($str);
 }