Hi,
I hope this will help you
$text = "This is some text. We will count number of words now.";
$count = count(explode(" ", $text));
echo "$text contains $count words";
First we explode text into words (separator is of course " ") and then count number of array elements.