$s = "PHP Programming";
foreach (count_chars($s, 1) as $i => $val)
echo "$val instance(s) of \"" . chr($i) . "\"" . "<br />";
/*
run:
1 instance(s) of " "
1 instance(s) of "H"
3 instance(s) of "P"
1 instance(s) of "a"
2 instance(s) of "g"
1 instance(s) of "i"
2 instance(s) of "m"
1 instance(s) of "n"
1 instance(s) of "o"
2 instance(s) of "r"
*/