Home > Backend Development > PHP Tutorial > 计算字符串长度,该怎么解决

计算字符串长度,该怎么解决

WBOY
Release: 2016-06-13 13:21:44
Original
1116 people have browsed it

计算字符串长度
计算字符串长度 如果遇到连续的数字这几个连续的数字算一个字符
如as123dd23er
有11个字符对吧 现在要计算成8个 请问有什么好的思路?

------解决方案--------------------

PHP code
echo strlen(preg_replace('/\d+/','a','as123dd23er')); <div class="clear">
                 
              
              
        
            </div>
Copy after login
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