11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 9 • STRINGS AND REGULAR EXPRESSIONSwww.it-ebooks.infoCharacter n appears 6 timesCharacter o appears 1 timesCharacter p appears 2 timesCharacter r appears 1 timesCharacter s appears 1 timesCharacter t appears 1 timesCharacter y appears 1 timesCounting the Total Number of Words in a StringThe function str_word_count() offers information regarding the total number of words found in a string.Its prototype follows:mixed str_word_count(string str [, int format])If the optional parameter format is not defined, it will return the total number of words. If format isdefined, it modifies the function’s behavior based on its value:1: Returns an array consisting of all words located in str.2: Returns an associative array where the key is the numerical position of the wordin str and the value is the word itself.Consider an example:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!