_mb_strlen()
Internal compat function to mimic mb_strlen().
Only supports UTF-8 and non-shifting single-byte encodings. For all other encodings expect the counts to be wrong. When the given encoding (or the blog_charset if none is provided) isn’t UTF-8 then the function returns the byte-count of the provided string.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
int. Count of code points if UTF-8, byte length otherwise.
Использование
_mb_strlen( $str, $encoding );
- $str(строка) (обязательный)
- The string to retrieve the character length from.
- $encoding(строка|null)
- Count characters according to this encoding.
По умолчанию: to consultblog_charset
Список изменений
| С версии 4.2.0 | Введена. |
Код _mb_strlen() mb strlen WP 6.9.4
function _mb_strlen( $str, $encoding = null ) {
return _is_utf8_charset( $encoding ?? get_option( 'blog_charset' ) )
? _wp_utf8_codepoint_count( $str )
: strlen( $str );
}