php字符窜长度是如何计算的

WBOY
Release: 2016-06-13 13:35:55
Original
800 people have browsed it

php字符窜长度是怎么计算的?
比如
1 2
就是一个1一个空格,一个2,用strlen为什么会是5.。。。

------解决方案--------------------
不会吧。

C:\>php -r "echo strlen('1 2');"
3
------解决方案--------------------
如果你那个 1 和 2 是全角字符,不就是 5 了吗?
------解决方案--------------------
你的字符串肯定有问题的,要么如2楼所说有全角数字或全角空格,要么有看不见的特殊字符包含在里面。
------解决方案--------------------
应该是全角半角的问题吧,呵呵~~~~`

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!