Count words in a sentence
This is another example of how to count the number of words in a sentence .
Here is the script
<?php
$strText = "This is a test";
$wordcount = count(explode(" ",$strText));
echo "There are $wordcount words in $strText";
?>
and here is the output as you would expect
There are 4 words in This is a test