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

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

WBOY
WBOYOriginal
2016-06-13 13:21:441094browse

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

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

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