foreach (count_chars($keyword, 1) as $i => $val) { echo "There were $val instance(s) of \"" , chr($i) , "\" in the string.\n"; }
<?php $str = 'Test, test test, test. Test, test.'; echo substr_count( $str, ',' ); // 3 ?>