• PHP Video Tutorials

PHP - Function Str Word Count



Syntax

mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )

Definition and Usage

It returns information about words used in a string

Return Values

It returns array or integers.

Parameters

Sr.No Parameters & Description
1

string

It specifies the which string to check

2

return

It specifies the return value of string

3

char

It specifies which characters to be considered as words

Example

Try out the following example

<?php
   echo str_word_count("tutorials point simply easy learning");
?>

This will produce following result −

5
php_function_reference.htm
Advertisements