示例#1
0
 /**
  * Multibyte substr() implementation
  *
  * @param string  $str    The string to substr()
  * @param integer $start  The first position used
  * @param integer $length The maximum length of the returned string
  *
  * @return string Portion of $str specified by $start and $length
  * @see Net_Gearman_Connection::$multiByteSupport
  * @link http://us3.php.net/mb_substr
  * @link http://us3.php.net/substr
  */
 public static function subString($str, $start, $length)
 {
     if (is_null(self::$multiByteSupport)) {
         self::$multiByteSupport = intval(ini_get('mbstring.func_overload'));
     }
     if (self::$multiByteSupport & 2) {
         return mb_substr($str, $start, $length, '8bit');
     } else {
         return substr($str, $start, $length);
     }
 }