What does count_chars() do in PHP7?
The count_chars() function is used in PHP7 to retrieve data about a particular string using the string variable. Inside the parenthesis you will place two bits of information “count_chars($string,mode)”.
For the first part you will replace “$string” with the name of the variable for the string you are working with. Where you see “mode” you will put the number of the mode depending on the data you wish to have returned.
The modes you can use are:
0 – an array with the ASCII value as key and number of occurrences as value
1 – an array with the ASCII value as key and number of occurrences as value, only lists occurrences greater than zero
2 – an array with the ASCII value as key and number of occurrences as value, only lists occurrences equal to zero are listed
3 – a string with all the different characters used
4 – a string with all the unused characters