Esempio n. 1
0
 /**
  * This is a unicode aware replacement for substr()
  *
  * Uses mb_string extension if available
  *
  * @author Andreas Gohr <*****@*****.**>
  * @see    substr()
  */
 static function utf8_substr($str, $start, $length = null)
 {
     if (function_exists('mb_substr')) {
         return mb_substr($str, $start, $length, 'utf-8');
     }
     $uni = UTF8::utf8_to_unicode($str);
     return UTF8::unicode_to_utf8(array_slice($uni, $start, $length));
 }