Symfony\Polyfill\Mbstring
Mbstring::mb_strwidth
Метод класса: Mbstring{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = Mbstring::mb_strwidth( $s, $encoding );
- $s(обязательный)
- .
- $encoding
- .
По умолчанию:null
Код Mbstring::mb_strwidth() Mbstring::mb strwidth CF7 6.2.4.1
public static function mb_strwidth($s, $encoding = null)
{
$encoding = self::getEncoding($encoding);
static $wideChars = null;
if (null === $wideChars) {
$wideChars = self::getData('eastAsianWidthRegexp');
}
if ('UTF-8' !== $encoding) {
$s = self::iconv($encoding, 'UTF-8', $s);
} elseif (!preg_match('//u', $s)) {
// Each maximal subpart of an ill-formed sequence is one column wide
return preg_match_all(self::UTF8_CHAR_REGEX, $s) + preg_match_all($wideChars, self::scrubUtf8($s));
}
$s = preg_replace($wideChars, '', $s, -1, $wide);
return ($wide << 1) + iconv_strlen($s, 'UTF-8');
}