Count number of words in a text string

Count number of words in a text string
Description

This will count through the sentences in a section of text and show how many words are contained within it.
The code





$text = "This is some text.";



$count = count(explode(" ", $text));



echo "$text contains $count words";



?>

Posted in |