PHP Strings Primer - Counting
(Page 20 of 37 )
PHP includes the ability to count the number of characters in a string, the frequency that those characters appear, and the number of words that the characters form. Using the different functions that accomplish these tasks, we can accomplish many different everyday jobs. In this section, we will cover a few of the basic tasks possible with the following the functions.
count_chars(string [,mode]) -This function enables us to count the frequency of characters in a string. It offers several different methods of returning the results.strlen(string) -This is a basic function that simply returns the length of a string.str_word_count(string) -Introduced in PHP v4.3.0, this function returns the number of words in any given string.
Next: Checking password strength >>
More Programming Basics Articles
More By Matt Wade