Friday, April 3, 2015

How to count the number of words in a string - PHP Snippet

How to ount the number of words in a string

Use str_word_count() function to count the number of words in a string quickly.


echo str_word_count("Hello Hello world!"); // outputs 3

Disqus Comments