Remember that this will fail quite horribly if there is more than one space between the words.
It may be better to use regexps:
preg_match_all('/(\w+)\b/', $string, $aMatches);
echo count($aMatches[1]);
This count the number of times that $string contains a number of word-characters, followed by a word-boundry.
That means you can put spaces in to your hearts content, it will not mess up the count.