O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

str_word_count

Synopsis

mixed str_word_count(string string[, int format[, string characters]])

Counts the number of words in string using locale-specific rules. The value of format dictates the returned value:

0 (default)

The number of words found in string

1

An array of all words found in string

2

An associative array, with keys being the positions and values being the words found at those positions in string

If characters is specified, it provides additional characters that are considered to be inside words (that is, are not word boundaries).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required