Home  >  Article  >  Backend Development  >  PHP 字符串的空格数计算,该怎么解决

PHP 字符串的空格数计算,该怎么解决

WBOY
WBOYOriginal
2016-06-13 13:44:051340browse

PHP 字符串的空格数计算
我想计算我一长串字符串的空格数的数量 该如何操作呢???

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

PHP code

$string = 'afsj sakjfa adfas sakjf';
$res    = count_chars($string, 0);

echo    $res[32]; <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