PHP Write a script which uses a function named “countCharacters” that accepts an argument as string. This function should count and display the character and the number of appearance for that particular character. Function should count as case insensitive. count_chars & substr_count predefined functions cannot be used. Hint: Associative arrays will be a good idea. Example: if my string is “Hello” then the output should be: H:1 E:1 L:2 O:1
PHP
Write a script which uses a function named “countCharacters” that accepts an argument as string. This function should count and display the character and the number of appearance for that particular character. Function should count as case insensitive. count_chars & substr_count predefined functions cannot be used.
Hint: Associative arrays will be a good idea.
Example: if my string is “Hello” then the output should be: H:1
E:1
L:2
O:1
Step by step
Solved in 3 steps with 1 images