PHP count_chars() Function

The count_chars() function is used to count how many times an ASCII character occurs within sentence.

Demo :



Type Text
Array ( )

Example :

Type sentance at the text box like this Hello World!.Then click count button the result will display with character count like this Array ( [32] => 1 [33] => 1 [72] => 1 [87] => 1 [100] => 1 [101] => 1 [108] => 3 [111] => 2 [114] => 1 ) . In the above input all are display ASCII character.

32 => ''
33 => !
72 => H
100 => d
101 => e
108 => l
111 => o
114 => r
119 => w

If you need to count how many times an ASCII character occurs within sentence following code useful to you.

<?php
$str = "Hello World";
$result =count_chars($str,1);
echo print_r($result);
?>

The count_chars() function have in the two parameters that name is string input, string mode.

Free Download Script :

If you need count_chars() function demo code download from following link.

Download




Content