What does count_chars() do in PHP7?

A1WEBSITEPRO QuestionsCategory: PHPWhat does count_chars() do in PHP7?
Sam T asked 5 years ago

What does count_chars() do in PHP7?

What does count_chars() do in PHP7? was last modified: November 24th, 2018 by Sam T
1 Answers
Best Answer
Maximus Mccullough Staff answered 5 years ago

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

Only cool people share!

Answer for What does count_chars() do in PHP7? was last modified: November 24th, 2018 by Maximus Mccullough