how can we count space between text in php ?
example: hi how are you?
spaces: 3
is there any way to count spaces ?
Language : Only PHP
how can we count space between text in php ?
example: hi how are you?
spaces: 3
is there any way to count spaces ?
Language : Only PHP
You're looking for preg_match_all
.
$numSpaces = preg_match_all('/[ ]/', $testStr, $matches);