PHP count_chars() function returns information about characters used in a string.
Syntax
mixed count_chars(str,mode);
Parameter | Description |
---|---|
str : | Required parameter. The examined string. |
mode : | Optional parameter. Returns modes. 0 is default. different modes are following:
|
Return Value : | Returns one of the mode mentioned above. |
<?php echo count_chars("Returns one of the mode mentioned above",7); ?>
<?php $strArray = count_chars("Returns one of the mode mentioned above",1); foreach ($strArray as $key=>$val) { echo "There were $val instance(s) of \"" , chr($i) , "\" in the string.\n"; } ?>