mb_strwidth

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

mb_strwidth返回字符串的宽度

说明

mb_strwidth ( string $str [, string $encoding = mb_internal_encoding() ] ) : int

返回 string 类型 str 的宽度。

多字节字符通常是单字节字符的两倍宽度。

字符宽度
字符 宽度
U+0000 - U+0019 0
U+0020 - U+1FFF 1
U+2000 - U+FF60 2
U+FF61 - U+FF9F 1
U+FFA0 - 2

参数

str

待解码的 string

encoding

encoding 参数为字符编码。如果省略,则使用内部字符编码。

返回值

string str 的宽度。

参见

相关文章
php 多字节字符串 函数 检查字符串在指定的编码里是否有效php 多字节字符串 函数 get a specific characterphp 多字节字符串 函数 对字符串进行大小写转换php 多字节字符串 函数 转换字符的编码php 多字节字符串 函数 replace regular expression with multibyte supportphp 多字节字符串 函数 returns start point for next regular expression matchphp 多字节字符串 函数 retrieve the result from the last multibyte regular expression matchphp 多字节字符串 函数 setup string and regular expression for a multibyte regular expression matchphp 多字节字符串 函数 返回所有支持编码的数组php 多字节字符串 函数 get code point of characterphp 多字节字符串 函数 在输出缓冲中转换字符编码的回调函数php 多字节字符串 函数 解析 get/post/cookie 数据并设置全局变量php 多字节字符串 函数 获取按指定宽度截断的字符串php 多字节字符串 函数 查找指定字符在另一个字符串中最后一次的出现php 多字节字符串 函数 大小写不敏感地查找指定字符在另一个字符串中最后一次的出现php 多字节字符串 函数 大小写不敏感地在字符串中查找一个字符串最后出现的位置php 多字节字符串 函数 查找字符串在一个字符串中最后出现的位置php 多字节字符串 函数 返回字符串的宽度php output control 函数 刷出(送出)缓冲区内容,以字符串形式返回内容,并关闭输出缓冲区。php 程序执行函数 通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。
关注编程学问公众号