开发者

Check char size in utf8 encoding

开发者 https://www.devze.com 2023-02-19 21:30 出处:网络
Is there any simple solution to check on how m开发者_如何学编程any bytes are stored char in utf8.If you have a string, then :

Is there any simple solution to check on how m开发者_如何学编程any bytes are stored char in utf8.


If you have a string, then :

  • strlen() will give you the number of bytes it takes
  • while mb_strlen() will give you the number of characters it contains


strlen() returns the number of bytes. mb_strlen() returns the number of multibyte characters.

0

精彩评论

暂无评论...
验证码 换一张
取 消