-7
$a='Would you like to have responses to your questions sent to you via email'

for($a as $b=>c){

}

请给我解决方案

4

4 回答 4

5
<?php echo substr_count($a, 't'); ?>
于 2013-07-16T07:08:45.967 回答
0

这是一个解决方案,虽然不一定是最好的

$letterCount = array_count_values(
    str_split(strtolower($a))
);
$tCount = (isset($letterCount['t'])) ? $letterCount['t'] : 0;
于 2013-07-16T07:08:14.583 回答
0
$count = preg_match_all('/t/', $str);
于 2013-07-16T07:08:46.477 回答
0

检查这个

<?php

$a = 'Would you like to have responses to your questions sent to you via email';

$t_explod = explode('t', strtolower($a));

echo count($t_explod) - 1;
?>
于 2013-07-16T07:10:12.250 回答