PHP count_chars()functionPHP count_chars() is most important string function. It is used to return information about characters in a string. Syntax:
Note: Depending on mode 'count_chars()' function returns one of the following:
Example 1Output: Your given string: Hello World! By using 'count_chars()' function your string is : !HWdelor Example 2Output: Array ( [32] => 1 [33] => 1 [72] => 1 [87] => 1 [100] => 1 [101] => 1 [108] => 3 [111] => 2 [114] => 1 ) Example 3Output: The character ' ' was found 3 time(s) The character '!' was found 1 time(s) The character 'H' was found 1 time(s) The character 'L' was found 2 time(s) The character 'P' was found 2 time(s) The character 'a' was found 2 time(s) The character 'e' was found 2 time(s) The character 'g' was found 2 time(s) The character 'i' was found 1 time(s) The character 'l' was found 1 time(s) The character 'n' was found 1 time(s) The character 'o' was found 1 time(s) The character 's' was found 1 time(s) The character 'u' was found 1 time(s) The character 'v' was found 1 time(s) The character 'y' was found 1 time(s) Next TopicPHP String |