php验证字符串长度问题

C:\Users\Administrator>php -r "echo strlen('你好')";
4
C:\Users\Administrator>php -r "echo mb_strlen('你好')";
4
C:\Users\Administrator>php -r "echo mb_strlen('你好','utf-8')";
3
C:\Users\Administrator>php -r "echo mb_strlen('你好','gbk')";
2
C:\Users\Administrator>php -r "echo mb_strlen('你好','gb2312')";
2
C:\Users\Administrator>php -r "echo mb_strlen('你好','i')";

转载于:https://www.cnblogs.com/andydao/p/3160743.html

你可能感兴趣的:(php验证字符串长度问题)