Home >>PHP String Functions >PHP count_chars() Function
The PHP count_chars() functionis used in PHP to get all the information related to the characters present in the given input string. This is an in-built function of PHP. Using this ount_char() function, we can get different information about the input string, like the number of times a character occur in the given string, all the ASCII characters that are not present in the string.
Syntax :
count_chars(string,return_mode)
Let's see some examples for this function:
<html> <body> <?php $str = "PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications."; echo count_chars($str,3); ?> </body> </html>
Example 2
<html> <body> <?php $str = "PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications."; print_r(count_chars($str,1)); ?> </body> </html>