如何在php中的文本语句中计算空间

11 php text spaces count

我们如何计算php中文本之间的空间?

example: hi how are you?

spaces: 3
Run Code Online (Sandbox Code Playgroud)

有没有办法计算空间?

语言:只有PHP

gah*_*ooa 42

用这个:

substr_count($text, ' ');
Run Code Online (Sandbox Code Playgroud)