The str_word_count() function counts the number of words available in the variable value.
Example:
[php]<?php
echo str_word_count("Hello world!");
?> [/php]
It will generate the following result.
2
The str_word_count() function has counted the number of words available in the variable value "Hello World!" and returned the result 2.