Mega Code Archive

 
Categories / Php / Code Snippets
 

Count number of words in a text string

<? php$text = "This is some text."; $count = count(explode(" ", $text)); echo "$text contains $count words"; ?>