str_word_count()We can use str_word_count string function to get all details of words present in the string. Here is one example.
Simple counting of words can be done like this, however we can more information on words with optional parameter like this.
Here is one example with integer format = 1 , we will get an array with words as element of the array. Here is the output.
Output of this is here
Now let us try with format value as 2
Output is here
We can specify additional chars which can be considered as a word.
Here 2 will be considered as part of the word so now the word plus2net will be treated as single word..
This article is written by plus2net.com team.