PHP str_word_count() string function



The str_word_count() function in PHP

The php str_word_count() sting function is used to count a number of words in a string.

str_word_count() function syntax

str_word_count(“string”);

PHP str_word_count() function example

In above example there are three words in a given string the “Hello”, “Meera” and “Academy”.

The output is:

The number of words in a string = 3

PHP str_word_count() example with php form

The out put is :

PHP str_word_count() string function

PHP str_word_count() string function

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *