Count the words from a string using php with following snippet.

$str = 'hello world to scriptplazza';
$num = str_word_count($str); // $num = 4
 

Leave a Comment