• Teach Your Self With
             w3htmlschool.com

PHP count_char Function

The count_chars() function counts the number of occurrences of each character in string (For example how many time an ASCII character occurs in a string ) returns result in various mode
Example
Example Output

Syntax


count_chars ( string $string [, int $mode = 0 ] )
Different Return Mode are :
Default is 0
0- an array key contain the ASCII value and number of occurrences as value.
1 -an array key contain the ASCII value and number of occurrences as value, with a frequency greater than zero are listed.
2 - an array key contain the ASCII value and number of occurrences as value, with a frequency equal to zero are listed.
3 - a string containing all unique characters is returned.
4 - a string containing all not used characters is returned.